Ü  Access particular member of a file

A.     If you want to do this inside of the RPG then have at least V5R1, you can use EXTFILE and EXTMBR.

       

FFile1     if   e             Disk    Extfile(FilNam) ExtMbr(Member Name)

 

 

o   Creating logical file for member 5 of  MYFILELF physical file

 

 

 CRTLF FILE(KCS/MYFILELF) SRCFILE(KCS/KC1) DTAMBRS((KCS/MYFILEPF (MBR5)))

 Or,

 ADDLFM FILE(KCS/MYFILELF) MBR(MYFILEBR) DTAMBRS((KCS/MYFILEPF (MBR5)))

                                                             

 

o For accounting purpose each month data can be stored as 12 different members so that we can easily access one month data or 12 months together. Easy to maintain 12 members in one PF file instead of 12 PF Files. Hence, in such a case the members will be JANUARY, FEBRUARY, MARCH and so on.

 

o To maintain the same data but for different system id.

 

 

Ü  How to access all the member of a file

 


    Columns . . . :    6  76           Browse                       AMIT/QRPGLESRC
     SEU==>                                                                MBR_READ
     FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++
            *************** Beginning of data *************************************
    0001.00 FCUST      IF   E             DISK    EXTMBR('*ALL')                   
    0001.01 F                                     INFDS(FILEDS)                    
    0001.02  *                                                                     
    0001.03 DFILEDS           DS                                                    
    0001.04 DRECORD             *RECORD                                            
    0001.05 DMEMBER                 129    138                                     
    0001.06 DDB_RRN                 397    400I 0                                   
    0001.07  *                                                                     
    0001.08  *                                                                     
    0001.09 DDATA1            DS                                                    
    0001.10 DFLD1                           10                                     
    0001.11 DFILLER1                         2    INZ('--')                        
    0001.12 DFLD2                           10                                      
    0001.13 DFILLER2                         2    INZ('--')                        
    0001.14 DFLD3                            4  0                                  
    0001.15 DFILLER3                         2    INZ('--')
    0001.16  *                                                                     
    0001.17  *                                                                     
    0001.18 DDATA2            DS                                                   
    0001.19 DFLD4                            6                                     
    0001.20 DFILLER4                         2    INZ('--')                        
    0001.21 DFLD5                           10                                     
    0001.22 DFILLER5                         2    INZ('--')                        
    0001.23 DFLD6                            5  0                                  
    0001.24 DFILLER6                         2    INZ('--')                        
    0001.25 DFLD7                           10  0                                   
    0001.26  *                                                                     
    0001.27  *                                                                     
    0001.28  *                                                                      
    0002.00 C                   READ      CUST                                   90
    0003.00 C                   DOW       NOT %EOF(CUST) AND *IN90=*OFF            
    0003.02 C                   EVAL      FLD1=MEMBER                               
    0003.03 C                   EVAL      FLD2=RECORD                              
    0003.04 C                   EVAL      FLD3=DB_RRN                              
    0003.05 C                   EVAL      FLD4=CSNBR                               
    0003.06 C                   EVAL      FLD5=CSNAME                              
    0003.07 C                   EVAL      FLD6=CS#OPN                              
    0003.08 C                   EVAL      FLD7=CS$OPN                              
    0003.09 C     DATA1         DSPLY                                              
    0003.10 C     DATA2         DSPLY                                              
    0003.11 C                   READ      CUST                                   90
    0004.00 C                   ENDDO                                              
    0005.00 C                   SETON                                        LR    
            ****************** End of data ****************************************

                                                                               

                                                                               

 

CUST

 

CSNBR   CSNAME      CS#OPN          CS$OPN

000001  AMI              0             .00

000002  upi              0             .00

000003  KUM              0             .00

000004  RAHIN       12,256      454,654.51

000005  HARISH         980      798,789.00

000006  RAJESH         560      754,555.00

000007  RONYSH         888      755,555.00

000008  KUNINA         447      755,555.00

000009  SHIUNA         222      744,444.00

000010  OINUJI         555      666,666.00

000011  FOSSIL         575      999,999.00

000012  BEKULL       5,858    4,545,645.00

000013  ROBIN        1,111    2,525,255.00

000014  SONIK        2,222    8,484,848.00

000015  KEVIN        7,552    8,484,848.00

000016  SAKIN        7,777    7,777,777.00

000017  TURNI        9,877    9,879,877.00

000018  SUPPI        2,227    4,564,567.00

000019  KHUSI        7,777    4,564,567.00

000020  SAHIL        8,888    8,888,888.00

000021  KAPIL        3,333    3,333,333.00

000022  RONIK        4,444    4,444,444.00

000023  KWNIK        5,555    4,555,555.00

********  End of data  ********

                                                                                

                                                                         

 

OUTPUT

 


Display Program Messages
 
    DSPLY  CUST      --CUSTR     --0001--
    DSPLY  000001--AMI       --00000--0000000000
    DSPLY  CUST      --CUSTR     --0002--
    DSPLY  000002--upi       --00000--0000000000
    DSPLY  CUST      --CUSTR     --0003--
    DSPLY  000003--KUM       --00000--0000000000
    DSPLY  CUST      --CUSTR     --0004--
    DSPLY  000004--RAHIN     --12256--0000454654
    DSPLY  CUST      --CUSTR     --0005--
    DSPLY  000005--HARISH    --00980--0000798789
    DSPLY  CUST      --CUSTR     --0006--
    DSPLY  000006--RAJESH    --00560--0000754555
    DSPLY  CUST      --CUSTR     --0007--
    DSPLY  000007--RONYSH    --00888--0000755555
    DSPLY  CUST      --CUSTR     --0008--
    DSPLY  000008--KUNINA    --00447--0000755555
    DSPLY  CUST      --CUSTR     --0009--
    DSPLY  000009--SHIUNA    --00222--0000744444
    DSPLY  CUST      --CUSTR     --0010--
    DSPLY  000010--OINUJI    --00555--0000666666
    DSPLY  CUST      --CUSTR     --0011--
    DSPLY  000011--FOSSIL    --00575--0000999999
    DSPLY  CUST      --CUSTR     --0012--
    DSPLY  000012--BEKULL    --05858--0004545645
    DSPLY  CUST      --CUSTR     --0013--
    DSPLY  000013--ROBIN     --01111--0002525255
    DSPLY  CUST      --CUSTR     --0014--
    DSPLY  000014--SONIK     --02222--0008484848
    DSPLY  CUST      --CUSTR     --0015--
    DSPLY  000015--KEVIN     --07552--0008484848
    DSPLY  000016--SAKIN     --07777--0007777777
    DSPLY  CUST      --CUSTR     --0017--
    DSPLY  000017--TURNI     --09877--0009879877
    DSPLY  CUST      --CUSTR     --0018--
    DSPLY  000018--SUPPI     --02227--0004564567
    DSPLY  CUST      --CUSTR     --0019--
    DSPLY  000019--KHUSI     --07777--0004564567
    DSPLY  CUST      --CUSTR     --0020--
    DSPLY  000020--SAHIL     --08888--0008888888
    DSPLY  CUST      --CUSTR     --0021--
    DSPLY  000021--KAPIL     --03333--0003333333
    DSPLY  CUST      --CUSTR     --0022--
    DSPLY  000022--RONIK     --04444--0004444444
    DSPLY  CUST      --CUSTR     --0023--
    DSPLY  000023--KWNIK     --05555--0004555555
    DSPLY  MBR2      --CUSTR     --0001--
    DSPLY  100002--upi       --00000--0000000000
    DSPLY  MBR2      --CUSTR     --0002--
    DSPLY  100003--KUM       --00000--0000000000
    DSPLY  MBR3      --CUSTR     --0001--
    DSPLY  100003--KUM       --00000--0000000000
    DSPLY  CUST      --CUSTR     --0001--

 

 





User Comments:





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