TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)

302 Chapter6
Host Language Access
RPG
F KIMAGE ORDERSLC
F KITEM PURCH-DATE
F KLEVEL DO-ALL
F KSTATUSSTAT
FTERMIN ID F 79 $STDIN
FTERMOUT O V 79 $STDLST
****************************************************************
* TABLE/ARRAY DECLARATIONS *
****************************************************************
E ESC 1 1 1 Escape = 27
****************************************************************
* INPUT RECORD LAYOUTS *
****************************************************************
ISALES NS
I B 1 40ACCT#
I 5 12 STOCK#
I 6 13 140QTY
I 7 15 180$PRICE
I 5 19 220$TAX
I 8 23 260$TOTAL
I 27 320PDATE
I 33 380DDATE
ITERMIN NS
I 1 8 OPTION
Main Body of Program
****************************************************************
* CALCULATIONS MAINLINE *
****************************************************************
C* Execute GETSAL subroutine, then end program.
C*
C EXSR GETSAL
C SETON LR
Retrieving All the Records on a Chain (with Item Level Locking)
This subroutine implements the GET-SALES-FOR-DATE routine of the sample program.
Chained access is achieved using the CHAIN operation which performs a DBFIND call and
a DBGET call on the first execution, and then DBGET calls on subsequent executions for the
same search value. Thus a loop is done on the CHAIN operation in order to retrieve all the
entries in the data item chain. The routine traps two exceptional conditions: failure to find
a chain head, and reaching end-of-chain.
****************************************************************
* G E T S A L S U B R O U T I N E *
****************************************************************
C GETSAL BEGSR
C*--------------------------------------------------------------
C* Display prompt for date and read user input from screen.
C*
C EXCPT CLEAR
C EXCPT GETDAT
C READ TERMIN H0