Ü To read from the database file and then write
it on the screen.
Columns . . . : 1 71 Browse AMIT/QRPGLESRC
SEU==> READDSPFCL
FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
*************** Beginning of data *************************************
0001.00 PGM
0002.00 DCLF FILE(*LIBL/ACC_DSPF)
0002.01 DCLF FILE(AMIT/ACCOUNT) OPNID(ID1)
0002.02 DCL VAR(&COUNT) TYPE(*INT) VALUE(0)
0002.03 DCL VAR(&CHAR) TYPE(*CHAR) VALUE(' ')
0003.00 READ:
0003.01 IF COND(&IN03 *EQ '0') THEN(DO)
0003.10 RCVF OPNID(ID1)
0003.11 MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END1))
0003.12 CHGVAR VAR(&S_ORG) VALUE(&ID1_ORG)
0003.13 CHGVAR VAR(&S_ACC) VALUE(&ID1_ACC)
0003.14 CHGVAR VAR(&S_CCY) VALUE(&ID1_CCY)
0003.15 CHGVAR VAR(&S_PARTY) VALUE(&ID1_PARTY)
0003.16 CHGVAR VAR(&COUNT) VALUE(&COUNT+1)
0003.17 CHGVAR VAR(&CHAR) VALUE(&COUNT)
0003.18 CHGVAR VAR(&S_MSG) VALUE('THIS IS RECORD NO' +
0003.19 *CAT ' ' *CAT &CHAR)
0003.20 SNDF RCDFMT(HEADER)
0003.21 SNDF RCDFMT(FOOTER)
0003.22 RCVF RCDFMT(HEADER)
0003.23 GOTO READ
0005.10 ENDDO
0007.00 END1:
0007.01 CLOF OPNID(ID1)
0007.02 MONMSG MSGID(CPF4520)
0007.03 /** BY USING THIS THE MSG CPF4520 WON'T APPEAR **/
0009.00 ENDPGM
****************** End of data ****************************************
Below is the display file that has
been used in the program:
Columns . . . : 1 80 Browse AMITCCCCC/QRPGLESRC
SEU==> ACC_DSPF
FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++++++
*************** Beginning of data *************************************************
0001.00 A DSPSIZ(24 80 *DS3)
0002.00 A CA03(03 'EXIT')
0003.00 A CA12(12 'PREVIOUS')
0004.00 A R HEADER
0005.00 A 1 30'ACCOUNT ENTRY DISPLAY'
0006.00 A DSPATR(HI)
0007.00 A COLOR(BLU)
0008.00 A 4 25'ORG'
0009.00 A DSPATR(HI)
0010.00 A COLOR(BLU)
0011.00 A S_ORG 3S 0B 4 35
0012.00 A FLDCSRPRG(S_ACC)
0013.00 A 50 DSPATR(RI)
0014.00 A 5 25'ACC'
0015.00 A DSPATR(HI)
0016.00 A COLOR(BLU)
0017.00 A S_ACC 12A B 5 35
0018.00 A FLDCSRPRG(S_CCY)
0019.00 A 51 DSPATR(RI)
0020.00 A 6 25'CCY'
0021.00 A DSPATR(HI)
0022.00 A COLOR(BLU)
0023.00 A S_CCY 3A B 6 35
0024.00 A FLDCSRPRG(S_PARTY)
0025.00 A 52 DSPATR(RI)
0026.00 A 7 25'PARTY'
0027.00 A DSPATR(HI)
0028.00 A COLOR(BLU)
0029.00 A S_PARTY 12A B 7 35
0030.00 A 53 DSPATR(RI)
0031.00 A R FOOTER
0032.00 A OVERLAY
0033.00 A 22 5'F3 = EXIT'
0034.00 A DSPATR(HI)
0035.00 A COLOR(BLU)
0036.00 A 22 20'F12 = CANCEL'
0037.00 A DSPATR(HI)
0038.00 A COLOR(BLU)
0039.00 A S_MSG 30A O 23 2
****************** End of data ***************************************************
***NOTE: We can use SNDRCVF
instead of SNDF and RCVF.
SNDRCVF is used only
for display file.
OUTPUT
ACCOUNT ENTRY DISPLAY
ORG 190
ACC A00000000001
CCY EUR
PARTY P00000000001
F3 = EXIT F12 = CANCEL
THIS IS RECORD NO 1
We press ENTER to get the screen below:
ACCOUNT ENTRY DISPLAY
ORG 191
ACC A00000000002
CCY USD
PARTY P00000000002
F3 = EXIT F12 = CANCEL
THIS IS RECORD NO 2