Ü   Multiple file read operation in CL

 

If we want to use multiple files in the CL program, we need to use OPEN ID for this.

                       


 Columns . . . :    1  71           Browse                       AMIT/QRPGLESRC
 SEU==>                                                              READDSPFCL
 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
        *************** Beginning of data *************************************
0001.00 PGM                                                                    
0002.00              DCLF       FILE(*LIBL/ACC_DSPF)                           
0002.01              DCLF       FILE(AMIT/ACCOUNT) OPNID(ID1)                  
0002.02              DCLF       FILE(AMIT/CUST) OPNID(ID2)                     
0002.03              DCL        VAR(&COUNT) TYPE(*INT) VALUE(0)                
0002.04              DCL        VAR(&CHAR) TYPE(*CHAR) VALUE(' ')              
0003.00 READ:                                                                  
0003.01              IF         COND(&IN03 *EQ '0') THEN(DO)                   
0003.10              RCVF       OPNID(ID1)                                     
0003.12              MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END1))         
0003.13              RCVF       OPNID(ID2)                                      
0003.14              MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END1))         
0003.15              CHGVAR     VAR(&S_ORG) VALUE(&ID1_ORG)                    
0003.16              CHGVAR     VAR(&S_ACC) VALUE(&ID1_ACC)                     
0003.17              CHGVAR     VAR(&S_CCY) VALUE(&ID1_CCY)                    
0003.18              CHGVAR     VAR(&S_PARTY) VALUE(&ID1_PARTY)     
0003.19              CHGVAR     VAR(&COUNT) VALUE(&COUNT+1)                    
0003.20              CHGVAR     VAR(&CHAR) VALUE(&COUNT)                       
0003.21              CHGVAR     VAR(&S_MSG) VALUE('THIS IS RECORD NO' +        
0003.22                         *CAT ' ' *CAT &CHAR +                          
0003.23                         *CAT ' ' *CAT &ID2_CSNAME)                     
0003.24              SNDF       RCDFMT(HEADER)                                 
0003.25              SNDF       RCDFMT(FOOTER)                                 
0003.26              RCVF       RCDFMT(HEADER)                                 
0003.27              GOTO       READ                                           
0005.10              ENDDO                                                     
0007.00 END1:                                                                   
0007.01              CLOF       OPNID(ID1)                                     
0007.02              MONMSG     MSGID(CPF4520)                                 
0007.03              CLOF       OPNID(ID2)                                      
0007.04              MONMSG     MSGID(CPF4520)                                 
0007.05              /** BY USING THIS THE MSG CPF4520 WON'T APPEAR **/        
0009.00 ENDPGM                                                           
        ****************** End of data ****************************************



                        

 

OUTPUT

 


                             ACCOUNT ENTRY DISPLAY                             
                                                                               
                                                                               
                        ORG       190                                          
                        ACC       A00000000001                                 
                        CCY       EUR                                          
                        PARTY     P00000000001                                 
                                                                               
                                                     
                                                                                
    F3 = EXIT      F12 = CANCEL                                                
 THIS IS RECORD NO 1 AMI                         

                           

 

 

 

Now we press ENTER to get the OUTPUT below:

 

 


                             ACCOUNT ENTRY DISPLAY                             
                                                                               
                                                                               
                        ORG       191                                          
                        ACC       A00000000002                                 
                        CCY       USD                                          
                        PARTY     P00000000002                                 
                                                                               
                         
                                                                               
    F3 = EXIT      F12 = CANCEL                                                 
  THIS IS RECORD NO 2 upi     

 

 





User Comments:





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