Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1083282
  • 博文数量: 106
  • 博客积分: 9093
  • 博客等级: 中将
  • 技术积分: 2770
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-01 17:22
文章分类

全部博文(106)

文章存档

2014年(1)

2012年(29)

2011年(32)

2010年(20)

2008年(24)

分类:

2010-08-19 16:43:39

CLRL关键字的作用是在写当前的record的时候清除先前显示文件的指定内容。
如:


这样有什么好处?运用此关键字可以实现用一个record去覆盖另一个record的部分内容。
如下面的例子,效果如图:

代码如下:
PTRLIB/QDDSSRC(STATES)
     A                                      UNIQUE
     A          R RSTATES
     A            STATCD         2
     A            STATDS        15
     A          K STATCD

PTRLIB/QDDSSRC(SFD600)
     A                                      DSPSIZ(24 80 *DS3)
     A                                      CF03(03 'EXIT')
     A          R SFD600A                   SFL
     A            STATCD    R        B  8  3REFFLD(RSTATES/STATCD *LIBL/STATES)
     A                                      COLOR(WHT)
     A            STATDS    R        B  8 13REFFLD(RSTATES/STATDS *LIBL/STATES)
     A                                      COLOR(WHT)
     A          R SFD600B                   SFLCTL(SFD600A)
     A                                      OVERLAY
     A  30                                  SFLDSP
     A                                      SFLDSPCTL
     A  31                                  SFLINZ
     A                                      SFLSIZ(0100)
     A                                      SFLPAG(0010)
     A  35                                  SFLEND(*MORE)
     A                                  1  4DATE
     A                                      EDTCDE(Y)
     A                                      COLOR(BLU)
     A                                  2  4TIME
     A                                      COLOR(BLU)
     A                                  1 26'Input State Codes'
     A                                      COLOR(WHT)
     A                                  1 69USER
     A                                      COLOR(BLU)
     A                                  2 69'SFR600'
     A                                      COLOR(BLU)
     A                                  6  1'State code'
     A                                      COLOR(PNK)
     A                                      DSPATR(UL)
     A                                  6 13'Description     '
     A                                      COLOR(PNK)
     A                                      DSPATR(UL)
     A          R TRAILER
     A                                 23  2'F3-Exit'
     A                                      COLOR(WHT)
     A          R READS
     A                                      CLRL(*NO)
     A                                 15 44'Number of Reads'
     A                                 16 44'Number of Records Entered'
     A            @READS         5Y 0O 15 73COLOR(PNK)
     A                                      EDTCDE(Z)
     A            @RCDS          5Y 0O 16 73COLOR(PNK)
     A                                      EDTCDE(Z)
     A
 PTRLIB/QRPGSRC(SFR600)
     FSFD600  CF  E                    WORKSTN
     F                                        @RRN  KSFILE SFD600A
     C**************************************************************************
     C* MAIN ROUTINE                                                           *
     C**************************************************************************
     C           #CTL      CASEQ'MAIN'    @MAIN
     C           #CTL      CASEQ'END '    @END
     C                     ENDCS
     C**************************************************************************
     C* MAIN SUBROUTINE                                                        *
     C**************************************************************************
     C           @MAIN     BEGSR
     C*
     C           #CTL      DOWEQ'MAIN'
     C*
     C                     WRITETRAILER
     C                     MOVE *ON       *IN30
     C  N88                WRITESFD600B
     C   88                EXFMTSFD600B
     C  N88                EXFMTREADS
     C*
     C                     SELEC
     C* F3 KEY
     C           *IN03     WHEQ *ON
     C                     MOVEL'END '    #CTL
     C* ENTER KEY
     C                     OTHER
     C                     EXSR @READ
     C           @RCDS     IFNE *ZERO
     C                     SETOF                     88
     C                     ELSE
     C                     SETON                     88
     C                     ENDIF
     C                     ENDSL
     C*
     C                     ENDDO
     C*
     C                     ENDSR
     C**************************************************************************
     C* END SUBROUTINE                                                         *
     C**************************************************************************
     C           @END      BEGSR
     C*
     C                     SETON                     LR
     C                     RETRN
     C*
     C                     ENDSR
     C**************************************************************************
     C* @READ Read the records inputted from the subfile                       *
     C**************************************************************************
     C           @READ     BEGSR
     C*
     C                     Z-ADD*ZERO     @READS
     C                     Z-ADD*ZERO     @RCDS
     C                     Z-ADD*ZERO     @RRN
     C                     MOVE *OFF      *IN99
     C*
     C           *IN99     DOWEQ*OFF
     C                     ADD  1         @RRN
     C           @RRN      CHAINSFD600A              99
     C*
     C           *IN99     IFEQ *ON
     C                     LEAVE
     C                     ENDIF
     C*
     C                     ADD  1         @READS
     C*
     C           STATCD    IFNE *BLANKS
     C           STATDS    ANDNE*BLANKS
     C                     ADD  1         @RCDS
     C                     ENDIF
     C*
     C                     ENDDO
     C*
     C*
     C                     ENDSR
     C**************************************************************************
     C* *INZSR                                                                 *
     C**************************************************************************
     C           *INZSR    BEGSR
     C*
     C                     Z-ADD*ZERO     @RRN    50
     C                     MOVEL'MAIN'    #CTL    4
     C                     SETON                     3588
     C*
     C                     MOVE *ON       *IN31
     C                     WRITESFD600B
     C                     MOVE *OFF      *IN31
     C*
     C                     ENDSR

当使用此关键字的时候在dspf中option indicator将不可用,如下面的71.
A  71                                  DSPATR(PC)   
程序只是实现了简单的功能。欢迎大家讨论。                                              
更多此关键字的内容请参照IBM AS/400信息中心
阅读(2134) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~