Try this method to simulate a load-all display subfile with file positioning in CL.3-6 show the code for a Territory Inquiry program as an example of how this can be accomplished. 7 shows the results.
Try this method to simulate a load-all display subfile with file positioning in CL. Figures 3-6 show the code for a Territory Inquiry program as an example of how this can be accomplished. Figure 7 shows the results.
The program displays multiple lines of a message subfile that contains file data instead of error messages. The file is positioned through an Override Database File (OVRDBF) command and the data is read, formatted, and sent as a program message to the program message queue that is displayed by the message subfile.
If the file is positioned beyond the last record, an error message will be displayed. By using the ERRSFL keyword in the display file, the keyboard remains unlocked and multiple error messages can be displayed!
-Tom Connover
TechTalk: CL Subfiles
Figure 3: Physical File TERRFL
*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A UNIQUE A R TERRFLR TEXT('Territory File') A ITERNM 25A TEXT('Territory Name') A ITERCD 3A TEXT('Territory Code') A K ITERNM
TechTalk: CL Subfiles
Figure 4: Display File TERRDF
*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A DSPSIZ(24 80 *DS3) A CA03(03 'Exit') A PRINT A ERRSFL A R TERDSP A 1 29'Territory File Inquiry' A 3 2'Territory:' A TERDSC 25A B 3 13 A 20 ERRMSG('No records to display.' 20) A 5 2'Territory Name' A 5 32'Code' A R MSGSFL SFL A SFLMSGRCD(06) A MSGKEY SFLMSGKEY A PGMQ SFLPGMQ A R MSGCTL SFLCTL(MSGSFL) A OVERLAY A SFLDSP A SFLDSPCTL A N40 SFLEND A SFLINZ A SFLSIZ(0018) A SFLPAG(0017) A PGMQ SFLPGMQ A R FKEYS OVERLAY A 24 2'F3=Exit' *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
TechTalk: CL Subfiles
Figure 5: CL Program TERRCL1
PGM DCLF FILE(TERRDF) CHGVAR VAR(&PGMQ) VALUE(TERRCL1) LOOP: SNDF RCDFMT(TERDSP) SNDF RCDFMT(MSGCTL) SNDF RCDFMT(FKEYS) RCVF RCDFMT(TERDSP) IF COND(&IN03) THEN(GOTO CMDLBL(END)) RMVMSG CLEAR(*ALL) CALL PGM(TERRCL2) PARM(&TERDSC &IN20) GOTO CMDLBL(LOOP) END: RMVMSG CLEAR(*ALL) ENDPGM
TechTalk: CL Subfiles
Figure 6: CL Program TERRCL2
PGM PARM(&TERDSC &IN20) DCL VAR(&TERDSC) TYPE(*CHAR) LEN(25) DCL VAR(&IN20) TYPE(*CHAR) LEN(1) DCLF FILE(TERRFL) OVRDBF FILE(TERRFL) POSITION(*KEYAE 1 *N &TERDSC) LOOP: RCVF MONMSG MSGID(CPF0864) EXEC(RETURN) MONMSG MSGID(CPF4167) EXEC(DO) CHGVAR VAR(&IN20) VALUE('1') RETURN ENDDO SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&ITERNM + *CAT ' ' *CAT &ITERCD) GOTO CMDLBL(LOOP) ENDPGMTechTalk: CL Subfiles
Figure 7: Example CL Subfile Screen
LATEST COMMENTS
MC Press Online