Ü Single Page/non-elastic Subfile
·
In this case sub file size
(SFLSIZ) must be equal to subfile page (SFLPAG).
·
Every time the record is
written in the buffer, buffer is cleared before writing. After clearing the subfile
buffer, records equal to the size of SFLPAG is written. Hence every time we
find SFLSIZ=SFLPAG.
·
We call this subfile Non-elastic
also which means, the buffer size will be equal to the page size always.
·
In this case, PAGEUP and
PAGEDOWN handling is required.
Single
page subfile Example
Physical
file used in the program = MASTER
ORG CODE ACC NUMBER CURRENCY OPEN DATE PARTY NUM A/C STS ENT STS VER STS AUT STS REC STS TIMESTAMP
190 A00000000001 EUR 20120605 P00000000001 2 1 1 1 2 2012-06-05-03.07.34.011000
190 A00000000002 USD 20120605 P00000000002 3 1 1 1 2 2012-06-05-03.07.49.859000
190 A00000000004 EUR 1072012 P00000000004 2 2 1 1 2 0001-01-01-00.00.00.000000
190 A00000000005 USD 6072011 P00000000005 1 1 1 1 1 0001-01-01-00.00.00.000000
191 A00000000006 USD 9082012 P00000000006 2 1 1 1 1 0001-01-01-00.00.00.000000
191 A00000000007 EUR 9082000 P00000000007 2 1 1 1 1 0001-01-01-00.00.00.000000
191 A00000000008 USD 9082007 P00000000008 1 1 1 1 1 0001-01-01-00.00.00.000000
192 A00000000009 TRY 6092000 P00000000009 2 2 2 2 2 0001-01-01-00.00.00.000000
192 A00000000010 INR 1012012 P00000000001 2 1 1 1 2 0001-01-01-00.00.00.000001
192 A00000000011 INR 1012022 P00000000012 1 2 1 1 2 0001-01-01-00.00.00.000021
192 A00000000012 INR 1012022 P00000000002 2 2 1 1 2 0001-01-01-00.00.00.000011
******** End of data ********
Display
file used in the program = SNGL_DSP
Columns . . . : 1 80 Browse AMIT/QRPGLESRC
SEU==> SNGL_DSP
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 PAGEDOWN(66)
0004.00 A ALTPAGEDWN(CF08)
0005.00 A PAGEUP(44)
0006.00 A ALTPAGEUP(CF07)
0007.00 A R HEADER
0008.00 A OVERLAY
0009.00 A 1 3USER
0010.00 A DSPATR(HI)
0011.00 A COLOR(BLU)
0012.00 A 1 71DATE
0013.00 A EDTCDE(Y)
0014.00 A DSPATR(HI)
0015.00 A COLOR(BLU)
0016.00 A 2 71TIME
0017.00 A DSPATR(HI)
0018.00 A COLOR(BLU)
0019.00 A 1 23'DISPLAY THE SINGLE PAGE SUBFILE'
0020.00 A DSPATR(HI)
0021.00 A COLOR(BLU)
0022.00 A R FOOTER
0023.00 A OVERLAY
0024.00 A 23 7'F3'
0025.00 A DSPATR(RI)
0026.00 A COLOR(WHT)
0027.00 A 23 10'= EXIT'
0028.00 A 23 26'F12'
0029.00 A DSPATR(HI)
0030.00 A DSPATR(RI)
0031.00 A 23 30'=PREVIOUS'
0032.00 A R EXPD_SFL SFL
0033.00 A 56 SFLNXTCHG
0034.00 A S_ORG 3S 0O 8 12
0035.00 A S_ACC 12A O 8 28
0036.00 A S_CCY 3A O 8 49
0037.00 A R EXPD_CTL SFLCTL(EXPD_SFL)
0038.00 A OVERLAY
0039.00 A 52 SFLDSP
0040.00 A 51 SFLDSPCTL
0041.00 A 50 SFLCLR
0042.00 A 45 SFLEND(*MORE)
0043.00 A SFLSIZ(0005)
0044.00 A SFLPAG(0005)
0045.00 A 6 12'ORG CODE'
0046.00 A 6 27'ACCOUNT NUMBER'
0047.00 A 6 48'CURRENCY'
****************** End of data ************************************************************
MAIN PROGRAM
Columns . . . : 6 80 Browse AMIT/QRPGLESRC
SEU==> SNGL_RPGLE
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
*************** Beginning of data ****************************************************
0001.00
0002.00 HDEBUG(*YES)
0003.00 HOPTION(*NODEBUGIO)
0004.00 FMASTER IF E K DISK
0005.00 FSNGL_DSP CF E WORKSTN
0006.00 F SFILE(EXPD_SFL:RRN)
0007.00 DLSTRRN s 1P 0 INZ(*ZEROS)
0008.00 DPRENO s 2P 0 INZ(*ZEROS)
0009.00 DNXTPGCOUNT s 2P 0 INZ(*ZEROS)
0010.00 DLSTPAGCNT s 2P 0 INZ(*ZEROS)
0011.00 C SETOFF 505152
0012.00 C SETOFF 45
0013.00 C *IN03 DOWEQ *OFF
0014.00 C EXSR MAIN
0015.00 C ENDDO
0016.00 C SETON LR
0017.00 C*
0018.00 C*_____________________________________________
0019.00 C*____________MAIN SUBROUTINE BEGINS HERE______
0020.00 C*_____________________________________________
0021.00 C MAIN BEGSR
0022.00 C*
0023.00 C*__________________PAGE DOWN__________________
0024.00 C*_____________________________________________
0025.00 C *IN66 IFEQ *ON
0026.00 C IF *IN45=*OFF
0027.00 C EXSR CLRSFL
0028.00 C EXSR NXTPAG
0029.00 C EXSR FILSFL
0030.00 C EXSR DSPSFL
0031.00 C ELSE
0032.00 C EXSR DSPSFL
0033.00 C ENDIF
0034.00 C ENDIF
0035.00 C*
0036.00 C*__________________PAGE UP____________________
0037.00 C*_____________________________________________
0038.00 C *IN44 IFEQ *ON
0039.00 C EXSR CLRSFL
0040.00 C EXSR PREPAG
0041.00 C EXSR FILSFL
0042.00 C EXSR DSPSFL
0043.00 C ENDIF
0044.00 C*____________________________________________
0045.00 C IF *IN66=*OFF AND *IN44=*OFF
0046.00 C EXSR DSPSFL
0047.00 C ENDIF
0048.00 *
0049.00 C ENDSR
0050.00 C*_________________________________________________
0051.00 C*_______________PRE PAGING________________________
0052.00 C*_________________________________________________
0053.00 C PREPAG BEGSR
0054.00 C IF NXTPGCOUNT=0
0055.00 C EVAL PRENO=SFLPAG*2
0056.00 C ELSE
0057.00 C EVAL PRENO=SFLPAG+1+NXTPGCOUNT
0058.00 C *HIVAL SETLL REC1
0059.00 C ENDIF
0060.00 C DO PRENO
0061.00 C READP(N) REC1
0062.00 C IF %EOF
0063.00 C *LOVAL SETLL REC1
0064.00 C ENDIF
0065.00 C ENDDO
0066.00 C EVAL PRENO=0
0067.00 C EVAL NXTPGCOUNT=0
0068.00 C ENDSR
0069.00 C*_________________________________________________
0070.00 C*_______________NXT PAGING________________________
0071.00 C*_________________________________________________
0072.00 C NXTPAG BEGSR
0073.00 C EVAL NXTPGCOUNT=0
0074.00 C DO SFLPAG
0075.00 C READ REC1
0076.00 C IF %EOF(MASTER)
0077.00 C* EVAL LSTPAGCNT=NXTPGCOUNT
0078.00 C *HIVAL SETLL REC1
0079.00 C LEAVE
0080.00 C ENDIF
0081.00 C EVAL NXTPGCOUNT=NXTPGCOUNT+1
0082.00 C ENDDO
0083.00 C DO NXTPGCOUNT
0084.00 C READP(N) REC1
0085.00 C ENDDO
0086.00 C IF NXTPGCOUNT<>SFLPAG
0087.00 C READP REC1
0088.00 C ENDIF
0089.00 C ENDSR
0090.00 C*_________________________________________________
0091.00 C*_______________CLEAR SUBFILE_____________________
0092.00 C*_________________________________________________
0093.00 C CLRSFL BEGSR
0094.00 C EVAL RRN=0
0095.00 C SETON 50
0096.00 C WRITE EXPD_CTL
0097.00 C SETOFF 50
0098.00 C ENDSR
0099.00 C*_________________________________________________
0100.00 C*_______________FIRST FUBROUTINE__________________
0101.00 C*_________________________________________________
0102.00 C*
0103.00 C *INZSR BEGSR
0104.00 C MOVEL 5 SFLPAG 1 0
0105.00 C Z-ADD *ZEROS RRN 1 0
0106.00 C EXSR CLRSFL
0107.00 C *LOVAL SETLL REC1
0108.00 C EXSR FILSFL
0109.00 C EXSR DSPSFL
0110.00 C ENDSR
0111.00 C*_________________________________________________
0112.00 C*_______________FILL SUBFILE__________________
0113.00 C*_________________________________________________
0114.00 C*
0115.00 C FILSFL BEGSR
0116.00 C SETON 52
0117.00 C SETOFF 45
0118.00 C DO SFLPAG
0119.00 C READ(N) REC1
0120.00 C IF %EOF(MASTER)
0121.00 C EVAL *IN45=%EOF(MASTER)
0122.00 C LEAVESR
0123.00 C ENDIF
0124.00 C EVAL S_ORG=ORG
0125.00 C EVAL S_ACC=ACC
0126.00 C EVAL S_CCY=CCY
0127.00 C ADD 1 RRN
0128.00 C WRITE EXPD_SFL
0129.00 C ENDDO
0130.00 C SETOFF 52
0131.00 C ENDSR
0132.00 C*_________________________________________________
0133.00 C*
0134.00 C DSPSFL BEGSR
0135.00 C SETON 5152
0136.00 C WRITE HEADER
0137.00 C WRITE FOOTER
0138.00 C EXFMT EXPD_CTL
0139.00 C ENDSR
****************** End of data *******************************************************
OUTPUT
AMIT DISPLAY THE SINGLE SUBFILE 2/21/13
08:07:59
ORG CODE ACCOUNT NUMBER CURRENCY
190 A00000000001 EUR
190 A00000000002 USD
190 A00000000004 EUR
190 A00000000005 USD
191 A00000000006 USD
More...
F3 = EXIT F12 =PREVIOUS