Ü   SFLNXTCHG

 

·         This keyword is very useful in case of editable subfile.

·         If before processing the subfile records, we are validating those records, then first of all we will use REACDC to find the records that is to be validated and then again by using READC we will process the same records.

·         But READC works the first time but not the second time on the same record.

·         The reason behind is, the first READC operation issued on the record, sets the MDT(modified data tag) off, resulting into the situation in which that record won’t be read again by 2nd READC operation.

·         READC identifies the records that have been changed by the processing option.2nd time since the MDT flag for those records will be off, the records won’t be treated as the changed records.

·         Now if we want that the second time also the record should be read, so that it can be processed, we need to use SFLNXTCHG keyword.

·         One more thing to note about is that the record of a subfile is treated to be changed if it is field exited or it is keyed into or some wrong processing option is taken or some wrong entry/update is made to the record.

 

 

 

 




Example

 

 

Below is the display file used for the program. Here we have assigned an indicator 66 for keyword SFLNXTCHG. This helps in validating the window subfile that appears after taking option-1 on the main subfile screen. The window subfile facilitates entry of new record on the screen. When we enter the record, first of all the program validates the records and then makes the SFLNXTCHG indicator *ON so that the same record can be read again with READC operation. After this we write the record to the database. VALIDATE1 is the subroutine that we using to validate the subfile. Inside this subroutine only, we are setting indicator 66 *on. Then there is subroutine UPDATEPF to update the physical file.

 

 
     A                                      DSPSIZ(24 80 *DS3)
     A                                      CA03(03 'EXIT')
     A                                      CA12(12)
     A          R HEADER
     A                                      OVERLAY
     A                                  1  2USER
     A                                      COLOR(BLU)
     A                                  1 25'DISPLAY THE EDITABEL SUBFILE'
     A                                      COLOR(BLU)
     A                                  1 70DATE
     A                                      COLOR(BLU)
     A                                      EDTCDE(Y)
     A                                  2 70TIME
     A                                      COLOR(BLU)
     A                                      EDTCDE(Y)
     A                                  5  5'OPTION: 1 = NEW A/C ENTRY FOR PART-
     A                                      Y, 2=EDIT, 4 = DELETE, 5 =DISPLAY'
     A                                      COLOR(BLU)
     A*
     A          R EXPD_SFL                  SFL
     A  56                                  SFLNXTCHG
     A            S_OPT          1A  B  9  5
     A  50                                  COLOR(YLW)
     A            S_PNAME       12A  O  9 11
     A  50                                  COLOR(YLW)
     A            S_PNUM        12A  O  9 26
     A  50                                  COLOR(YLW)
     A            S_PADDR       10A  B  9 45
     A  50                                  COLOR(YLW)
     A  50                                  DSPATR(PC)
     A* 50                                  DSPATR(BL)
     A  51                                  DSPATR(PR)
     A N51                                  DSPATR(UL)
      *
     A          R EXPD_CTL                  SFLCTL(EXPD_SFL)
     A  43                                  SFLDSP
     A  42                                  SFLDSPCTL
     A  41                                  SFLCLR
     A  45                                  SFLEND(*MORE)
     A                                      SFLSIZ(9999)
     A                                      SFLPAG(0005)
     A                                  8  5'OPT   PARTY NAME     PARTY NUMBER'
     A                                      COLOR(BLU)
     A                                  8 45'PARTY ADDRESS'
     A                                      COLOR(BLU)
      *
     A          R FOOTER                    OVERLAY
     A                                 23 03'F3 = EXIT'
     A                                      COLOR(BLU)
     A          R EXPD_WND
     A                                      WINDOW(7 20 15 45)
     A                                 02 15'PARTY INFORMATION'
     A                                      COLOR(BLU)
     A                                 04 02'PARTY NAME'
     A                                      COLOR(BLU)
     A            W_PNAME       12   O 05 02
     A                                 04 15'PARTY NUMBER'
     A                                      COLOR(BLU)
     A            W_PNUM        12   O 05 15
     A                                 07 02'PARTY ADDRESS'
     A                                      COLOR(BLU)
     A            W_PADDR       10   O 08 02
     A                                 07 17'OPEN DATE'
     A                                      COLOR(BLU)
     A            W_OPNDT       10   O 08 17
     A                                 10 02'OPEN STATUS'
     A                                      COLOR(BLU)
     A            W_OPNSTS       1Y 0O 11 02
     A                                 14 02'F3 = EXIT'
     A                                      COLOR(BLU)
     A
     A          R ACC_SFL                   SFL
     A  66                                  SFLNXTCHG        >>>>>>>>>>>>
     A            A_ORG          3Y 0B 05 02EDTCDE(4)
     A  81                                  DSPATR(RI)
     A  81                                  DSPATR(PC)
     A            A_ACC         12   B 05 09
     A  82                                  DSPATR(RI)
     A  82                                  DSPATR(PC)
     A            A_CCY         03   B 05 25
     A  83                                  DSPATR(RI)
     A  83                                  DSPATR(PC)
     A            A_MNGR        10   B 05 32
     A            A_CNTRY       10   B 05 46
      *
     A          R ACC_CTL                   SFLCTL(ACC_SFL)
     A                                      WINDOW(06 15 13 57)
     A                                      SFLPAG(0005)
     A                                      SFLSIZ(9999)
     A  63                                  SFLDSP
     A  62                                  SFLDSPCTL
     A  61                                  SFLCLR
     A  60                                  SFLINZ
     A                                      SFLRNA
     A  65                                  SFLEND(*MORE)
     A                                 01 02'ENTER NEW ACCOUNTS FOR PARTY'
     A                                      COLOR(BLU)
     A            A_PNUM        12   O 01 31
     A            A_PNAME       12   O 01 45
     A                                 03 02'ORG   ACCOUNT NUMBER   +
     A                                      CCY   ACC MANAGER    COUNTRY'
     A                                      COLOR(BLU)
      *
     A          R ACC_FOOTER
     A                                      WINDOW(ACC_CTL)
     A                                      OVERLAY
     A                                 12 02'F12 = CANCEL'
     A                                      COLOR(BLU)

 

 

 

 
      *
     HOPTION(*NODEBUGIO)
     FPARTYD    UF A E           K DISK
     FACCSUBPF  UF A E           K DISK
     FEDTDSPCC  CF   E             WORKSTN
     F                                     SFILE(EXPD_SFL:RRN)
     F                                     SFILE(ACC_SFL:RRN1)
      *
     DRRN              S              4P 0 INZ(*ZEROS)
     DRRN1             S              4P 0 INZ(*ZEROS)
     DRRNMAX           S              4P 0 INZ(*ZEROS)
     D@ERROR           S              1A   INZ(*BLANKS)
     DOPNDT            DS
     DMM                              2
     DFILLER1                         1    INZ('-')
     DDD                              2
     DFILLER2                         1    INZ('-')
     DYY                              4
      *______________________________________________
     C                   SETOFF                                       414243
     C                   SETOFF                                       818283
     C                   SETOFF                                       455051
     C                   SETOFF                                       5666
     C                   DOW       *IN03=*OFF
     C                   EXSR      MAIN
     C                   EXSR      DSPLY
     C                   ENDDO
     C                   SETON                                        LR
      *______________________________________________
      *___MAIN SUBROUTINE BEGINGS HERE_______________
     C     MAIN          BEGSR
     C                   READC     EXPD_SFL
     C                   DOW       NOT %EOF()
     C                   SELECT
     C     S_OPT         WHENEQ    '1'
     C                   EXSR      OPTION1
     C     S_OPT         WHENEQ    '2'
     C                   EXSR      OPTION2
     C     S_OPT         WHENEQ    '4'
     C                   EXSR      OPTION4
     C     S_OPT         WHENEQ    '5'
     C                   EXSR      OPTION5
     C                   OTHER
     C                   EXSR      VALIDATE
     C                   ENDSL
     C                   READC     EXPD_SFL
     C                   ENDDO
     C                   ENDSR
      *______________________________________________
      *___DSPLY SUBROUTINE BEGINS HERE_______________
     C     DSPLY         BEGSR
     C                   EXSR      CLRSFL
     C                   EXSR      FILSFL
     C                   EXSR      DSPSFL
     C                   ENDSR
      *___________________________________________
     C     CLRSFL        BEGSR
     C                   SETON                                        41
     C                   WRITE     EXPD_CTL
     C                   SETOFF                                       41
     C                   ENDSR
      *___________________________________________
     C     FILSFL        BEGSR
     C                   SETOFF                                       45
     C                   EVAL      RRN=0
     C     *LOVAL        SETLL     REC2
     C                   READ      REC2
     C                   DOW       NOT %EOF(PARTYD)
     C                   EVAL      S_PNAME=PNAME
     C                   EVAL      S_PNUM=PNUM
     C                   EVAL      S_PADDR=PADDR
     C                   EVAL      RRN=RRN+1
     C                   WRITE     EXPD_SFL
     C                   READ      REC2
     C                   ENDDO
     C                   IF        %EOF(PARTYD)
     C                   SETON                                        45
     C                   ENDIF
     C                   EVAL      RRNMAX=RRN
     C                   EXSR      TURNONPR
     C                   ENDSR
      *____________________________
     C     DSPSFL        BEGSR
     C                   SETON                                        4243
     C                   WRITE     EXPD_CTL
     C                   WRITE     HEADER
     C                   WRITE     FOOTER
     C                   READ      EXPD_CTL
     C                   SETOFF                                       4243
     C                   ENDSR
      *__________________________________________
      *
     C     TURNONPR      BEGSR
     C                   EVAL      RRN=1
     C                   DO        RRNMAX
     C     RRN           CHAIN     EXPD_SFL
     C                   SETON                                        51
     C                   UPDATE    EXPD_SFL
     C                   EVAL      RRN=RRN+1
     C                   ENDDO
     C                   ENDSR
      * _________________________________________
      *
     C     OPTION1       BEGSR
     C                   SETOFF                                       12
     C                   EXSR      CLEARACC
     C                   EXSR      LOADACC
     C                   EXSR      DSPACC
     C   12              LEAVESR
     C                   EXSR      VALIDATE1
     C                   DOW       @ERROR='Y'
     C                   SETON                                        6263
     C                   WRITE     ACC_CTL
     C                   WRITE     ACC_FOOTER
     C                   READ      ACC_CTL
     C   12              LEAVESR
     C                   EXSR      VALIDATE1
     C                   ENDDO
     C                   IF        @ERROR='N'
     C                   EXSR      UPDATEPF
     C                   ENDIF
     C                   SETOFF                                       6263
     C                   EVAL      @ERROR=' '
     C                   ENDSR
      * _________________________________________
      *
     C     OPTION2       BEGSR
     C     RRN           CHAIN     EXPD_SFL
     C                   SETON                                        50
     C                   SETOFF                                       51
     C                   UPDATE    EXPD_SFL
     C                   EXSR      DSPSFL
     C                   EVAL      S_OPT=*BLANKS
     C     S_PNUM        CHAIN     REC2                               91
     C                   IF        *IN91=*OFF
     C                   EVAL      PADDR=S_PADDR
     C                   UPDATE    REC2
     C                   ENDIF
     C                   SETOFF                                       5056
     C                   ENDSR
      *__________________________________________
      *
     C     OPTION4       BEGSR
     C     S_PNUM        CHAIN     REC2                               92
     C                   IF        *IN92=*OFF
     C                   DELETE    REC2
     C                   EVAL      S_OPT=*BLANKS
     C                   ENDIF
     C                   ENDSR
      *
      * _________________________________________
     C     OPTION5       BEGSR
     C     S_PNUM        CHAIN     REC2                               90
     C                   IF        *IN90=*OFF
     C                   EVAL      W_PNAME=PNAME
     C                   EVAL      W_PNUM=PNUM
     C                   EVAL      W_PADDR=PADDR
     C                   EVAL      DD=%CHAR(OPNDD)
     C                   EVAL      MM=%CHAR(OPNMM)
     C                   EVAL      YY=%CHAR(OPNYY)
     C                   EVAL      W_OPNDT=OPNDT
     C                   EVAL      W_OPNSTS=OPNSTS
     C                   ENDIF
     C                   EXFMT     EXPD_WND
     C                   EVAL      S_OPT=*BLANKS
     C                   ENDSR
      *
      *- --  - -- -  - - --- - - -- - - - -- -  - -
     C     VALIDATE      BEGSR
     C                   EVAL      S_OPT=*BLANKS
     C                   ENDSR
      *- - - - - - - - - - --  - - - - --  --  -- -
     C     LOADACC       BEGSR
     C                   EVAL      RRN1=0
     C     S_PNUM        SETLL     REC5
     C                   IF        %EQUAL()
     C     S_PNUM        READE     REC5
     C                   DOW       NOT %EOF(ACCSUBPF)
     C                   EVAL      A_ORG=ORG
     C                   EVAL      A_ACC=ACC
     C                   EVAL      A_CCY=CCY
     C                   EVAL      A_MNGR=ACCMNGR
     C                   EVAL      A_CNTRY=COUNTRY
     C                   EVAL      A_PNAME=S_PNAME
     C                   EVAL      A_PNUM=S_PNUM
     C                   EVAL      RRN1=RRN1+1
     C                   WRITE     ACC_SFL
     C     S_PNUM        READE     REC5
     C                   ENDDO
     C                   ENDIF
     C                   ENDSR
      *- -  - - --  -- -  - --  - -- - - - - - - - - - -
     C     CLEARACC      BEGSR
     C                   SETON                                        6061
     C                   WRITE     ACC_CTL
     C                   SETOFF                                       6061
     C                   ENDSR
      * -- - - - - - - - - - - - - - - - - -- - - - - -
     C     DSPACC        BEGSR
     C                   SETON                                        6263
     C                   WRITE     ACC_CTL
     C                   WRITE     ACC_FOOTER
     C                   READ      ACC_CTL
     C                   EVAL      S_OPT=*BLANKS
     C                   ENDSR
      *- -  - - -- -  - - - - - - - - - - - - - - - --
     C     UPDATEPF      BEGSR
     C                   READC     ACC_SFL                              95
     C                   DOW       NOT %EOF() AND @ERROR='N' AND *IN95=*OFF
     C                   EVAL      ORG=A_ORG
     C                   EVAL      ACC=A_ACC
     C                   EVAL      CCY=A_CCY
     C                   EVAL      ACCMNGR=A_MNGR
     C                   EVAL      COUNTRY=A_CNTRY
     C                   EVAL      PARTY=S_PNUM
     C                   WRITE     REC5
     C                   SETOFF                                       66
     C                   UPDATE    ACC_SFL
     C                   READC     ACC_SFL                              95
     C                   ENDDO
     C                   ENDSR
      * - - - - - - - - - -  -- -  -- -  - -- - - - -
     C     VALIDATE1     BEGSR
     C                   SETOFF                                       818283
     C                   EVAL      @ERROR=*BLANKS
     C                   READC     ACC_SFL
     C                   DOW       NOT %EOF()
     C                   IF        A_ORG=*ZEROS
     C                   EVAL      @ERROR='Y'
     C                   SETON                                        81
     C                   ENDIF
     C                   IF        A_ACC=*BLANKS
     C                   EVAL      @ERROR='Y'
     C                   SETON                                        82
     C                   ENDIF
     C                   IF        A_CCY=*BLANKS
     C                   EVAL      @ERROR='Y'
     C                   SETON                                        83
     C                   ENDIF
     C                   IF         @ERROR<>'Y'
     C                   EVAL       @ERROR='N'
     C                   ENDIF
     C                   SETON                                        66
     C                   UPDATE    ACC_SFL
     C                   READC     ACC_SFL
     C                   ENDDO
     C                   ENDSR
      *
      *========================================================
     C     *INZSR        BEGSR
     C                   EXSR      DSPLY
     C                   ENDSR

 




OUTPUT

 

Below is the main subfile screen where we can take option ‘1’ to make account entry.

 

 



AMIT                   DISPLAY THE EDITABEL SUBFILE                  9/04/13  
                                                                     11/59/03  
                                                                               
                                                                               
    OPTION: 1 = NEW A/C ENTRY FOR PARTY, 2=EDIT, 4 = DELETE, 5 =DISPLAY        
                                                                               
                                                                               
    OPT   PARTY NAME     PARTY NUMBER       PARTY ADDRESS  
    1     IROBO          P00000000001       CHENNAI                            
          IROBO          P00000000002       EMPHAL                             
          SHMANT         P00000000003       CHENNAI                            
          AFTAB          P00000000007       HOMEIIEA                           
          AMI            P00000000008       HELLY CORN                         
                                                                        More...


 
  F3 = EXIT                                                                    

 

 

 

In the screen below we don’t enter anything in account and press ENTER, It shows error, then we enter the account in the next screen.

 


AMIT                   DISPLAY THE EDITABEL SUBFILE                  9/04/13  
                                                                     11/59/03  
                                                                                

    OPTION: 1 = NEW A/C ENTRY FOR PARTY, 2=EDIT, 4 = DELETE, 5 =DISPLAY        
                 _________________________________________________________ 
                | ENTER NEW ACCOUNTS FOR PARTY P00000000001  IROBO        |
    OPT   PAR   |                                                         |          
    1     IRO   | ORG   ACCOUNT NUMBER   CCY   ACC MANAGER    COUNTRY     |
          IRO   |                                                         |
          SHM   | 195    A00000000006    TRY    APPRINA       SOUTN       |
          AFT   | 195    A00000000007    USD    SONATNA       SOUTN       |
          AMI   | 195    ____________    ___    _______       _____       |
                | ___    ___________     ___    _______       _____       |   ...
                | ___    ___________     ___    _______       _____       |      
                |                                                  More...|
                |                                                         |
                | F12 = CANCEL                                            |      
                |_________________________________________________________|
                                                                               

                                                                       
  F3 = EXIT              





AMIT                   DISPLAY THE EDITABEL SUBFILE                  9/04/13  
                                                                     11/59/03  
                                                                                
                                                                               
    OPTION: 1 = NEW A/C ENTRY FOR PARTY, 2=EDIT, 4 = DELETE, 5 =DISPLAY        
                 _________________________________________________________          
                | ENTER NEW ACCOUNTS FOR PARTY P00000000001  IROBO        |
    OPT   PAR   |                                                         |          
    1     IRO   | ORG   ACCOUNT NUMBER   CCY   ACC MANAGER    COUNTRY     |
          IRO   |                                                         |      
          SHM   | 195    A00000000006    TRY    APPRINA       SOUTN       |
          AFT   | 195    A00000000007    USD    SONATNA       SOUTN       |
          AMI   | 195    A00000000008    INR    JENNRPA       INDIA       | >>> New entered record
                | ___    ___________     ___    _______       _____       |   ...
                | ___    ___________     ___    _______       _____       |      
                |                                                  More...|      
                |                                                         |      
                | F12 = CANCEL                                            |      
                |_________________________________________________________|         
                                                                               


  F3 = EXIT              

 

 

Just press ENTER to update it.

It we don’t set SFLNXTCHG indicator *ON and try to make entry in the physical file, we doesn’t do anything and next time the corrected new record is not read by READC operation.

 





User Comments:





Copyright © Go4as400.com, 2013-2017. Copyright notice