在rpgle程序中使用了SFLCSRRRN&SFLRCDNBR时可以自己控制手动的对subfile的数据进行pageup/pagedown操作.不过在定义了sflrcdnbr对应的字段在初始化时需要给该字段赋初值.
例子(实例是完整)
dspf1:
A*%%EC
A DSPSIZ(24 80 *DS3)
A ROLLUP(08 '下一页')
A ROLLDOWN(07 '上一页')
A R SF SFL
A HXOTTYNO 10 O 12 2
A 96 COLOR(PNK)
A 95 COLOR(TRQ)
A 93 DSPATR(ND)
A HXMS 60 O 12 13
A 96 COLOR(PNK)
A 95 COLOR(TRQ)
A 93 DSPATR(ND)
A VERIFY 1 O 12 74
A 96 COLOR(PNK)
A 95 COLOR(TRQ)
A 93 DSPATR(ND)
A R HXR SFLCTL(SF)
A CF03(03 'EXIT')
A CF12(12 'EXIT')
A KEEP
A RTNCSRLOC(&CSRRCD &CSRFLD)
A OVERLAY
A SFLCSRRRN(&SFLCSR)
A N27 SFLDSP
A N27 SFLDSPCTL
A 29 SFLINZ
A 27 SFLCLR
A 28 SFLEND(*MORE)
A SFLRNA
A SFLSIZ(0011)
A SFLPAG(0010)
A SFLCSR 5S 0H
A SFLRRN 4S 0H SFLRCDNBR(CURSOR)
A CSRRCD 10A H
A CSRFLD 10A H
A 1 3'CPCR'
A DSPATR(HI)
A 1 9'YGHXNB'
A 1 28'kkkkkkkkkkkkkkkkkkkkkk'
A DSPATR(HI)
A 1 60TIME
A 2 69USER
A RQ 10A O 1 69
A 7 4'请输入kkkkkkkkkkkk'
A DSPATR(HI)
A HXND 4Y 0B 7 29
A 98 DSPATR(BL)
A 98 DSPATR(PC)
A EDTCDE(4)
A 94 DSPATR(ND)
A DSPATR(UL)
A 94 DSPATR(PR)
A N97 5 24'第一次做特殊业务核销操作'
A COLOR(PNK)
A 97 5 4'上次执行的核销年度:'
A COLOR(PNK)
A 97 HXNDL 4S 0O 5 26
A 97 5 34'核销日期'
A COLOR(PNK)
A 97 HXRQ 10A O 5 46
A 97 5 59'核销人'
A COLOR(PNK)
A 97 HXRY 10A O 5 68
A 9 3'以下是被拒绝或已修改不再处理摘要+
A 表'
A DSPATR(HI)
A 93 DSPATR(ND)
A 11 3'XXX表号'
A DSPATR(HI)
A 93 DSPATR(ND)
A 11 16'描述'
A DSPATR(HI)
A 93 DSPATR(ND)
A 11 73'VERIFY'
A DSPATR(HI)
A 93 DSPATR(ND)
A 9 40'(E=修改,R=拒绝)'
A COLOR(YLW)
A 93 DSPATR(ND)
A R FOOT
A OVERLAY
A MSGID 4A H
A 23 3'F12/03=Exit'
A COLOR(BLU)
A MSG 70A O 24 3MSGID(MSG &MSGID LTPSMSGF)
A DSPATR(HI)
A R ANSK
A CF09(09 'EXCUTE')
A CF03(03 'EXIT')
A CF12(12 'EXIT')
A KEEP
A WINDOW(10 10 5 50)
A WDWBORDER((*DSPATR RI) (*CHAR ' -
A '))
A 4 5'F9=确认'
A COLOR(BLU)
A 4 18'F03/F12=取消'
A COLOR(BLU)
A 2 5'是否确认执行XXX!?'
rpgle1:
F***************************************************************
F*FILE
F***************************************************************
Fdspf1 CF E WORKSTN SFILE(SF:RRN)
FYGHXNB IF A E K DISK
FESTTTY IF E K DISK
D***************************************************************
D*DECLEAR
D***************************************************************
D SDS
D MSGTXT 91 170
D USRNM 254 263
DWKDATE DS 10
D DD 1 2 0
D FLD 3 3 INZ('/')
D MM 4 5 0
D FLD1 6 6 INZ('/')
D YY 7 10 0
DRRN S 4 0 INZ
D
D
C***************************************************************
C*MAIN
C***************************************************************
C *ENTRY PLIST
C PARM JXFLG 1
C*INIT
C EXSR SUB000
C*PROCESS
C EXSR SUB020
C*EXIT
C EXIT TAG
C EXSR SUB030
C***************************************************************
C*PROCESS
C***************************************************************
C SUB020 BEGSR
C*ADD RECORD TO SF
C EXSR SUB023
C*
C DSPHX TAG
C WRITE FOOT
C EXFMT HXR
C EVAL MSGID='0000'
C*取消
C IF *IN03='1' OR *IN12='1'
C EVAL JXFLG='X'
C GOTO EXIT
C ENDIF
C*下一页
C IF *IN08
C SFLCSR IFNE 0
C Z-ADD SFLCSR SFLRRN
C ELSE
C Z-ADD RRN SFLRRN
C ENDIF
C MOVEL '0011' MSGID
C GOTO DSPHX
C ENDIF
C*上一页
C IF *IN07
C SFLCSR IFNE 0
C Z-ADD SFLCSR SFLRRN
C ELSE
C Z-ADD 1 SFLRRN
C ENDIF
C MOVEL '0010' MSGID
C GOTO DSPHX
C ENDIF
C*有被拒绝的数据或被修改的数据,是不可以做核销的
C IF *IN94='0'
C*检查年度的合法性
C EXSR SUB021
C*
C IF ERFLG='1'
C GOTO DSPHX
C ENDIF
C*如果输入无误执行相应的操作
C EXSR SUB022
C IF *IN03 OR *IN12
C SETOFF 1203
C GOTO DSPHX
C ENDIF
C ELSE
C GOTO DSPHX
C ENDIF
C*
C ENDSR
C***************************************************************
C*SUB022
C***************************************************************
C SUB022 BEGSR
C*
C NEXT TAG
C EXFMT ANSK
C IF *IN09
C EVAL HXYEAR=HXND
C EVAL HXOPID=USRNM
C MOVE *YEAR HXYY
C MOVE *MONTH HXMM
C MOVE *DAY HXDD
C WRITE YGHXR
C EVAL JXFLG ='Y'
C GOTO EXIT
C ELSEIF *IN12 OR *IN03
C LEAVESR
C ENDIF
C GOTO NEXT
C*
C ENDSR
C***************************************************************
C*SUB021
C***************************************************************
C SUB021 BEGSR
C*
C MOVE '0000' MSGID
C MOVE '0' ERFLG 1
C EVAL *IN98='0'
C*
C IF HXNDS>HXND OR HXND=0
C EVAL MSGID='6178'
C EVAL ERFLG='1'
C EVAL *IN98='1'
C ENDIF
C
C*
C ENDSR
C***************************************************************
C*EXIT
C***************************************************************
C SUB030 BEGSR
C*
C EVAL *INLR='1'
C*
C ENDSR
C***************************************************************
C*INIT
C***************************************************************
C SUB000 BEGSR
C*上次核销的年份
C *HIVAL SETGT YGHXNB
C READP YGHXNB 31
C IF *IN31='0'
C MOVE HXYEAR HXNDS 4 0
C move hxdd DD
C move hxmm MM
C move hxyy YY
C MOVE WKDATE hxrq
c eval hxry=HXOPID
c eval HXNDL=hxyear
C EVAL *IN97='1'
C ELSE
C EVAL *IN97='0'
C ENDIF
C
C*
C EVAL JXFLG=' '
C move *DAY DD
C move *MONTH MM
C move *YEAR YY
C MOVE WKDATE RQ
C CLEAR RRN
C Z-ADD 1 SFLRRN
C*
C ENDSR
C***************************************************************
C*ADD RECORD TO SF
C***************************************************************
C SUB023 BEGSR
C*CLEAR SF
C EVAL *IN27='1'
C WRITE HXR
C EVAL *IN27='0'
C*ADD RECORD
C *LOVAL SETLL ESTTTY
C DOW 1=1
C READ ESTTTY 31
C IF RRN=9999 OR *IN31
C LEAVE
C ENDIF
C IF VERIFY ='R' OR VERIFY='E'
C EVAL HXOTTYNO=OTTYNO
C EVAL HXMS =TTYNAM
C IF VERIFY='R'
C EVAL *IN96='1'
C ELSE
C EVAL *IN95='1'
C ENDIF
C ADD 1 RRN
C WRITE SF
C ENDIF
C ENDDO
C*
c MOVE RRN RRN@ 5 0
C EVAL *IN28='0'
C EVAL *IN94='1'
C IF RRN=0
C EVAL *IN93='1'
C EVAL *IN94='0'
C EVAL HXOTTYNO=' '
C EVAL HXMS =' '
C EVAL VERIFY=' '
C EVAL RRN=1
C WRITE SF
C EVAL *IN28='1'
C ENDIF
C
C ENDSR
rpgle1这个程序中SUB023中为sflrrn=1,不管subfile中有没有数据必须赋一个初值,否者系统会报会话或是显示设备有错.
阅读(2158) | 评论(0) | 转发(0) |