IBMiAccess




Results 1 to 6 of 6

Thread: Sflnxtchg

  1. #1
    Code400 Newbie
    Join Date
    Mar 2006
    Location
    Delhi
    Posts
    19
    Rep Power
    0

    Sflnxtchg

    Hi,
    What is the significance of SFLNXTCHG inidcator?
    What are all the possible cases where we will use this indicator?
    Can you provide any example?

  2. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

  3. #2
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,429
    Rep Power
    12629

    Re: Sflnxtchg

    Ibm:
    Subfile Operations with SFLNXTCHG for Display Files
    A typical use of SFLNXTCHG could be as follows:

    A work station user changes some records in a displayed
    subfile (this could be for a data-entry application or a
    data-update application). After changing some records,
    the work station user presses the Enter key, and the
    program reads only the changed records with
    get-next-changed operations.
    (For example, READC in RPG III and
    READ-SUBFILE-NEXT-MODIFIED in COBOL.)

    If the program detects keying errors in the changed
    records, it can send update operations
    (UPDATE in RPG IV, REWRITE SUBFILE in COBOL)
    to the subfile records in error, setting indicators
    so that SFLNXTCHG is in effect during the update
    operations. These update operations are sent to
    the subfile record format.

    After all the records in error have been updated,
    the program sends an output/input operation to
    the subfile control record format to display the
    subfile again.

    With the subfile displayed again, the work station user
    types the data again and presses the Enter key. If the
    data is correct, the program does not display the subfile
    again.

    The records in error
    (and any other records changed by the work station user)
    are returned to the program on the next get-next-changed
    operation. This is because SFLNXTCHG caused the subfile
    records to be considered changed even though the work
    station user did not change them. This allows the program
    to prohibit the work station user from ignoring
    program-detected keying errors in subfile records.

    PHP Code:
    example 
    00010A          R SFLR                      SFL
    00020A  14                                  SFLNXTCHG
         A
    *
         
    A*           (at least one input-capable field should be specified)
         
    A*
    00040A          R SFLCTLR                   SFLCTL(SFLR)
    00050A                                      SFLPAG(17)
    00060A                                      SFLSIZ(17)
    00070A                                      SFLDSP SFLDSPCTL
         A 
    READC
    PHP Code:
    Example
    FFilename
    ++IPEASFRlen+LKlen+AIDevice+.Keywords++++++++++++++++++++++++++++
     * 
    CUSSCR is a WORKSTN file which displays a list of records from
     
    the CUSINFO fileSFCUSR is the subfile name.
     *
    FCUSINFO   UF   E             DISK
    FCUSSCR    CF   E             WORKSTN SFILE
    (SFCUSR:RRN)
    F
    CL0N01Factor1
    +++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq....
     * 
    After the subfile has been loaded with the records from the
     
    CUSINFO fileIt is written out to the screen using EXFMT with
     
    the subfile control recordCTLCUS. If there are any changes in
     
    any one of the records listed on the screenthe READC operation
     
    will read the changed records one by one in the do while loop.
     * 
    The corresponding record in the CUSINFO file will be located
     
    with the CHAIN operation and will be updated with the changed
     
    field.
    C                   :
    C                   EXFMT     CTLCUS
    C                   
    :
     * 
    SCUSNOSCUSNAMSCUSADR, and SCUSTEL are fields defined in the
     
    subfileCUSNAMCUSADR, and CUSTEL are fields defined in a
     
    recordCUSREC which is defined in the file CUSINFO.
     *
    C                   READC     SFCUSR
    C                   DOW       
    %EOF = *OFF
    C     SCUSNO        CHAIN 
    (ECUSINFO                            
     
    Update the record only if the record is found in the file.
    C                   :
    C                   IF        NOT %ERROR
    C                   
    EVAL      CUSNAM SCUSNAM
    C                   
    EVAL      CUSADR SCUSADR
    C                   
    EVAL      CUSTEL SCUSTEL
    C                   UPDATE    CUSREC
    C                   
    ENDIF
    C                   READC (ESFCUSR
    C                   ENDDO 
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  4. #3
    Experienced Forum Member
    Join Date
    Oct 2006
    Location
    Lebanon
    Posts
    354
    Rep Power
    972

    Exclamation Re: Sflnxtchg

    hi jamief
    i have the same issue to update a subfile
    here is my code based on your code

    C F11 BEGSR
    c 'f11' dsply
    C READC RSTFL
    C DOW %EOF = *OFF
    C ##CDE CHAIN (E) DSC03LF
    *Update the record only if the record is found in the file.
    C IF NOT %ERROR
    C EVAL DSC03BNM= 'ZZZZZ'
    C UPDATE DSC03PFR
    C ENDIF
    C READC (E) RSTFL
    C ENDDO
    C ENDSR

    it is giving me the following error :
    Update or delete in file DSC03LF1 without prior input operation (C G D F).

    can you help me please?
    thanks

  5. #4
    Programmer Mercury's Avatar
    Join Date
    Feb 2007
    Location
    Paris, France
    Posts
    1,831
    Rep Power
    5435

    Re: Sflnxtchg

    IF %FOUND instead of IF NOT %ERROR.
    Philippe

  6. #5
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,429
    Rep Power
    12629

    Re: Sflnxtchg

    i agree....
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  7. #6
    Experienced Forum Member
    Join Date
    Oct 2006
    Location
    Lebanon
    Posts
    354
    Rep Power
    972

    Question Re: Sflnxtchg

    hi jamief and mercury

    i did wut you asked me to but still same error
    here is the screen 2 in the display file that contains the subfile

    Code:
    A          R SCREEN2                                               
    A  98                                  OVERLAY                     
    A                                      RTNCSRLOC(&CSRRCD2 &CSRFLD2 
    A            CSRRCD2       10A  H                                  
    A            CSRFLD2       10A  H                                  
    A            CSRPO2         4S 0H                                  
     *                                                                 
    A          R RSTFL                     SFL                         
     *                                                                 
    A  14                                  SFLNXTCHG                   
    A            ##INP          1A  B 12 10COLOR(WHT)   
    A            ##CDE         10A  O 12 15COLOR(GRN)   
    A            ##DES         10A  B 12 31COLOR(GRN)   
    A            ##ACB          4A  B 12 54COLOR(GRN)   
    A            ##ACN          6A  B 12 59COLOR(GRN)   
    A            ##ACS          3A  B 12 66COLOR(GRN)   
                                                        
    A          R RTSFLCTL                  SFLCTL(RSTFL)
    A                                      SFLSIZ(9999) 
    A  32                                  SFLEND(*MORE)               
    A  98                                  OVERLAY                     
    A  99                                  SFLDSP                      
    A  99                                  SFLDSPCTL                   
    A  26                                  SFLCLR                      
    A                                      RTNCSRLOC(&CSRRCD &CSRFLD &CSRPOS)
    A            CSRRCD        10A  H                                  
    A            CSRFLD        10A   H  
    A            CSRPOS         4S 0H                                  
    A            RECCOUNT       4S 0H      SFLRCDNBR(CURSOR)           
                                                                       
    A                                  4  2'Company Code . . . . . :'  
    A                                  5  2'Company Description. . :'  
    A                                  6  2'Company Currency. . . .:'  
    A                                  7  2'Account Number . . . . :'  
    A            ##CCDE        10A  O  4 27COLOR(WHT)                  
    A            ##CDES        35A  O  5 27COLOR(WHT)                  
    A            ##CCUR         3A  O  6 27COLOR(WHT)                  
    A            ##CACB         4A  O  7 27COLOR(WHT)                  
    A            ##CACN         6A  O  7 32COLOR(WHT)                  
    A            ##CACS         3A  O  7 39COLOR(WHT)                  
     *                                                                 
    A                                 10 15'ID'         
    A                                      COLOR(WHT)   
    A                                 10 31'Beneficiary'
    A                                      COLOR(WHT)   
    A                                 10 54'Account'    
    A                                      COLOR(WHT)   
    A            ##CDEINP      10A  I 11 15COLOR(WHT)   
    A            ##DESINP      10A  I 11 31COLOR(WHT)   
    A            ##ACBINP       4A  I 11 54COLOR(WHT)                                   
    A            ##DESINP      10A  I 11 31COLOR(WHT)        
    A            ##ACBINP       4A  I 11 54COLOR(WHT)        
    A            ##ACNINP       6A  I 11 59COLOR(WHT)        
    A            ##ACSINP       3A  I 11 66COLOR(WHT)        
     *

    my program contains two screen the first screen contains an input field where i choose a company code once enter key is pressed
    screen 2 appears containing the fixed info of the comany and the subfile showing all the employees of these company
    - the fields : description and account in the subfile are input and the user need to change them
    i need once i update all the values and press F11 i want here the update of the subfile to take place and update me the Physical file :dsc03lf1 containing the subfile fields

    here is my F11 code

    Code:
    C     F11           BEGSR                                    
                                
    C                   READC     RSTFL                          
    C                   DOW       %EOF = *OFF                    
    C     ##CDE         CHAIN (E) DSC03LF                        
     *Update the record only if the record is found in the file. 
    C                   IF        NOT %FOUND                     
    C                   EVAL      X_DSC03BNM= ##DES         
    C                   UPDATE    DSC031    
    C                   ENDIF              
    C                   READC (E) RSTFL    
    C                   ENDDO              
    C                   ENDSR
    I am still getting the same error of my previous post can you help me with this issue please
    thanks alot

  8. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. Another display file window problem
    By ChrisL in forum DDS
    Replies: 31
    Last Post: March 7th, 2006, 04:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •