January 1993 Newsletter
Volume 3, No. 1
Highlights of This Issue
INFINITE ARRAY DISPLAY IN INFORMIX 4GL by SAMEER GUPTA
Next Meeting
Our next meeting is scheduled for Wednesday, February 17, 1993 from 9:30 to 11:30 am. We have
a exciting presentation for the meeting from Four Seasons Software.
MEETING LOCATION: Informix Software
2111 Wilson Blvd., Suite 500
Arlington, VA
TOPICS Presentation - SuperNOVA from Four Seasons Software
Question and answer session.
Discussion - Future Plans for the User Group
SuperNOVA is a object-oriented, database independent, distributed processing 4GL application
development tool. It provides a highly productive, interactive development environment which can
eliminate traditional programming and is portable across multiple platforms (UNIX, MS-DOS, VMS).
Using SuperNOVA, users can develop character and GUI (MS-Windows, Motif and OpenLook)
applications. SuperNOVA's unique application independent, table driven distributed processing
architecture, supports a variety of network protocols (TCP/IP, X.25, and Starlan). SuperNOVA
interfaces to Informix, Oracle, Sybase, Ingres, Teradata, HP-Allbase, EDA/SQL, C_ISAM, in-core
memory files, and flat file databases.
PowerBuilder
At the December 9th Informix User Group meeting, Noblestar Systems Corporation demonstrated
an employee information application using PowerBuilder. PowerBuilder is a graphical user interface
("GUI") development tool which Noblestar and other firms have successfully used in the client-server
arena. This product has recently been updated with an Informix interface, allowing rapid
development of user-friendly GUI front-ends utilizing the Informix database.
For demonstration purposes, Noblestar is currently using the product with a number of stand-alone
databases, including Informix server for DOS 4.0, Gupta, and SQL*Server. Among the many
benefits to using a GUI tool such as PowerBuilder, is the ability to take advantage of the benefits of
client-server architecture, and relational databases such as Informix.
Noblestar has been operating as a beta test site for the Informix version of PowerBuilder and is
currently an authorized PowerBuilder trainer. If you would like more information on the uses of GUI
technology in a client-server environment, and whether the incorporation of PowerBuilder would be
advantageous to your applications development efforts, please contact Tim Bergloff at Noblestar's
Falls Church, VA headquarters at (703) 641-8511.
Acknowledgement to Management Information Consulting,
Inc.
Management Information Consulting, Inc has paid for the cost of copying and mailing our newsletter
for the last two years. MIC has maintained our mailing lists and put in a lot of time and effort into
getting the Informix User Group started. I would like to thank Cathy Begley, and MIC for all the
work they have done to support the user group. MIC will be unable to continue handling our mailing
list and we have appreciated their support.
Future of the Informix User Group
There are several issues we need to discuss at the next users group meeting.
We need a new sponsor for the mailings of the Newsletter.
We need to find ways to increase the participation in our user group. I was hoping to see
more people attend this last meeting. The Informix User Group needs you support and
participation to continue to operate and grow.
We need input from Informix users (you) on program ideas. What would you like to see at
the meetings? What do you find helpful?
Attached is a user survey. Please fill it out and send it in. At the next meeting we will have a
brainstorm of ideas and activities for the group.
by SAMEER GUPTA
TATA CONSULTANCY SERVICES
C/O Sheet Metal Workers Int'l Association
1750 New York Avenue NW
Washington DC 20006
I think the infinite array problem is more severe when a user wants to DISPLAY/ ALTER records
rather than when he wants to INPUT them as he user will always know as to how many are to be
input. He however will not be aware as to how many records might be retrieved by the select
statement.
The following program, display.4gl is a 4GL code to display infinite number of records in multiple
row format on the screen. The code fetches ahead so that the time delay to retrieve the records is not
very apparent. The user can use the UP, DOWN, F3, F4, PAGEUP and PAGEDOWN keys as in a
normal display array statement. However, it always jumps a full page ahead. The user can use F7 key
to exit. The code can be altered to make the display jump to a specified position (e.g. to a State
Description starting with a certain character).
The code can be modified to modify and delete records by selecting the currently displayed row
(identified by curdsp) and taking the necessary action.
Inserting infinite number of records can be achieved by physically inserting a specified number of
records every time the limit is reached.
display.4gl
----------------------------------------------------------------------
-- Program for displaying infinite number of records
-- Developed by SAMEER GUPTA 01/07/1993
----------------------------------------------------------------------
DATABASE mds
GLOBALS
DEFINE pcurr ARRAY[13] OF RECORD LIKE state_cm.*
# array to hold the current screen
DEFINE pnext ARRAY[13] OF RECORD LIKE state_cm.*
# array to hold the next screen
DEFINE pprev ARRAY[13] OF RECORD LIKE state_cm.*
# array to hold the previous screen
DEFINE counter SMALLINT
DEFINE maxcur SMALLINT
# number of records in the current array
DEFINE maxprv SMALLINT
# number of records in the previous array
DEFINE maxnxt SMALLINT
# number of records in the next array
DEFINE maxcnt SMALLINT
# maximum number of records that can be displayed on the screen FIXED VALUE
DEFINE pfirst SMALLINT
# pointer to the first record in the cursor
DEFINE plast SMALLINT
# pointer to the last record in the cursor
DEFINE curdsp SMALLINT
# current position on the screen
DEFINE inpval CHAR(1)
# Key value being input
END GLOBALS
MAIN
OPEN FORM dsp100 FROM "dsp100"
DISPLAY FORM dsp100
ATTRIBUTE (REVERSE, CYAN)
MESSAGE "Press F7 to Exit"
DECLARE c1 SCROLL CURSOR FOR
SELECT *
FROM state_cm
ORDER BY state_desc
LET maxcnt = 13
OPEN c1
------------------------------------------------------------------
-- Initialize the previous array
------------------------------------------------------------------
INITIALIZE pprev TO NULL
LET maxprv = 0
------------------------------------------------------------------
-- Build the current array
------------------------------------------------------------------
FETCH FIRST c1 INTO pcurr[1].*
LET pfirst = 1
LET plast = 1
FOR counter = 2 TO maxcnt
FETCH NEXT c1 INTO pcurr[counter].*
IF STATUS = NOTFOUND THEN
EXIT FOR
END IF
LET plast = plast + 1
END FOR
LET counter = counter - 1
LET maxcur = counter
IF maxcur = maxcnt THEN
------------------------------------------------------------------
-- Build the next array
------------------------------------------------------------------
LET plast = plast + 1
LET counter = 1
FETCH ABSOLUTE plast c1 INTO pnext[1].*
IF STATUS = NOTFOUND THEN
LET plast = plast - 1
ELSE
FOR counter = 2 TO maxcnt
FETCH NEXT c1 INTO pnext[counter].*
IF STATUS = NOTFOUND THEN
EXIT FOR
END IF
LET plast = plast + 1
END FOR
END IF
LET counter = counter - 1
LET maxnxt = counter
END IF
------------------------------------------------------------------
-- Display the first array
------------------------------------------------------------------
LET curdsp = 1
CALL dispcurr()
INPUT inpval FROM inpval
ATTRIBUTE (REVERSE, CYAN, INVISIBLE)
ON KEY(F3, NEXTPAGE)
IF maxnxt = 0 THEN
ERROR "END OF ARRAY"
ELSE
CALL fetchnext()
END IF
ON KEY(F4, PREVPAGE)
IF maxprv = 0 THEN
ERROR "START OF ARRAY"
ELSE
CALL fetchprev()
END IF
ON KEY(F7)
EXIT INPUT
ON KEY(DOWN)
IF curdsp < maxcnt THEN
DISPLAY pcurr[curdsp].* TO dsp100[curdsp].*
ATTRIBUTE (REVERSE, WHITE)
LET curdsp = curdsp + 1
IF curdsp <= maxcur THEN
DISPLAY pcurr[curdsp].* TO dsp100[curdsp].*
ATTRIBUTE (REVERSE, RED)
ELSE
LET curdsp = curdsp - 1
DISPLAY pcurr[curdsp].* TO dsp100[curdsp].*
ATTRIBUTE (REVERSE, RED)
ERROR "END OF ARRAY"
END IF
ELSE
CALL fetchnext()
END IF
ON KEY(UP)
IF curdsp > 1 THEN
DISPLAY pcurr[curdsp].* TO dsp100[curdsp].*
ATTRIBUTE (REVERSE, WHITE)
LET curdsp = curdsp - 1
DISPLAY pcurr[curdsp].* TO dsp100[curdsp].*
ATTRIBUTE (REVERSE, RED)
ELSE
IF maxprv = 0 THEN
ERROR "START OF ARRAY"
ELSE
CALL fetchprev()
END IF
END IF
AFTER FIELD inpval
NEXT FIELD inpval
END INPUT
END MAIN
FUNCTION fetchnext()
INITIALIZE pprev TO NULL
FOR counter = 1 TO maxcnt
LET pprev[counter].state_cd = pcurr[counter].state_cd
LET pprev[counter].state_desc = pcurr[counter].state_desc
END FOR
INITIALIZE pcurr TO NULL
FOR counter = 1 TO maxnxt
LET pcurr[counter].state_cd = pnext[counter].state_cd
LET pcurr[counter].state_desc = pnext[counter].state_desc
END FOR
LET pfirst = pfirst + maxprv
LET maxprv = maxcnt
LET maxcur = maxnxt
LET curdsp = 1
CALL dispcurr()
LET plast = plast + 1
INITIALIZE pnext TO NULL
LET counter = 1
FETCH ABSOLUTE plast c1 INTO pnext[1].*
IF STATUS = NOTFOUND THEN
LET plast = plast - 1
ELSE
FOR counter = 2 TO maxcnt
FETCH NEXT c1 INTO pnext[counter].*
IF STATUS = NOTFOUND THEN
EXIT FOR
END IF
LET plast = plast + 1
END FOR
END IF
LET counter = counter - 1
LET maxnxt = counter
END FUNCTION
FUNCTION fetchprev()
INITIALIZE pnext TO NULL
FOR counter = 1 TO maxcur
LET pnext[counter].state_cd = pcurr[counter].state_cd
LET pnext[counter].state_desc = pcurr[counter].state_desc
END FOR
FOR counter = 1 TO maxcnt
LET pcurr[counter].state_cd = pprev[counter].state_cd
LET pcurr[counter].state_desc = pprev[counter].state_desc
END FOR
LET plast = plast - maxnxt
LET maxnxt = maxcur
LET maxcur = maxcnt
LET curdsp = maxcnt
CALL dispcurr()
INITIALIZE pprev TO NULL
IF pfirst = 1 THEN
LET maxprv = 0
ELSE
LET pfirst = pfirst - 1
FETCH ABSOLUTE pfirst c1 INTO pprev[maxcnt].*
FOR counter = (maxcnt-1) TO 1 STEP -1
FETCH PREVIOUS c1 INTO pprev[counter].*
END FOR
LET pfirst = pfirst - maxcnt + 1
LET maxprv = maxcnt
END IF
END FUNCTION
FUNCTION dispcurr()
FOR counter = 1 TO maxcnt
DISPLAY pcurr[counter].* TO dsp100[counter].*
ATTRIBUTE (REVERSE, WHITE)
END FOR
DISPLAY pcurr[curdsp].* TO dsp100[curdsp].*
ATTRIBUTE (REVERSE, RED)
END FUNCTION
state_cm.sql
create table state_cm
(
state_cd char(2) not null,
state_desc char(20) not null
);
create index i01_state_cm on state_cm (state_cd);
create index ix111_2 on state_cm (state_desc);
display.per
DATABASE mds
SCREEN SIZE 24 BY 80
{
\gp------------------------------------------------------------------------------q\g
\g|\g Display State Codes DSP100
\g|\g
\g|------------------------------------------------------------------------------|\g
\g|\g Code Description
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [f1] [f2 ]
\g|\g
\g|\g [a] [f1] [f2 ]
\g|\g
\g|------------------------------------------------------------------------------|\g
\g|\g
\g|\g
\gb------------------------------------------------------------------------------d\g
}
TABLES
state_cm
ATTRIBUTES
a = FORMONLY.inpval TYPE CHAR, AUTONEXT;
f1 = state_cm.state_cd, AUTONEXT, UPSHIFT, COMMENTS = 'Enter the State Code.';
f2 = state_cm.state_desc, AUTONEXT, COMMENTS = 'Enter the State Description.';
END
INSTRUCTIONS
SCREEN RECORD dsp100[13] (state_cd, state_desc)
DELIMITERS " "
END
This Newsletter is published by the Washington Area Informix Users Group.
Lester Knutsen, President/Editor
Washington Area Informix Users Group
4216 Evergreen Lane, Suite 136, Annandale, VA 22003
Phone: 703-256-0267
lester@access.digex.net
|