Copy Some Records from PS to PS Example


Scenario - Copy sequential file records upto 'E0005' into a PDS member (PDS is already created).

Input PS File - MATEPK.IEBGENER.INPUTPS

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
E0001    EMPLOYEE1           DIR                 LOC1      0000100000    
E0002    EMPLOYEE2           MGR       DEPT1     LOC1      0000080000    
E0003    EMPLOYEE3           MGR       DEPT2     LOC2      0000075000    
E0004    EMPLOYEE4           TL        DEPT1     LOC1      0000050000    
E0005    EMPLOYEE5           SSE       DEPT1     LOC1      0000045000    
E0006    EMPLOYEE6           SE        DEPT1     LOC1      0000034000    
E0007    EMPLOYEE7           SSE       DEPT2     LOC2      0000046000

Code -

----+----1----+----2----+----3----+----4----+----5----+
//MATEPKG  JOB (123),'MTH',CLASS=A,MSGCLASS=A,
//             MSGLEVEL=(1,1),NOTIFY=&SYSUID
//**********************************************************
//* SPLIT SEQUENTIAL FILE RECORDS INTO DIFFERENT PDS MEMBERS
//**********************************************************
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPDS,DISP=OLD 
//SYSIN    DD  *
  GENERATE MAXNAME=1,MAXGPS=1
    MEMBER NAME=MEMBER4
    RECORD IDENT=(5,'E0005',1)
/*

Output - MATEPK.IEBGENER.OUTPDS(MEMBER4)

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 E0001    EMPLOYEE1           DIR                 LOC1      0000100000   
000002 E0002    EMPLOYEE2           MGR       DEPT1     LOC1      0000080000   
000003 E0003    EMPLOYEE3           MGR       DEPT2     LOC2      0000075000   
000004 E0004    EMPLOYEE4           TL        DEPT1     LOC1      0000050000   
000005 E0005    EMPLOYEE5           SSE       DEPT1     LOC1      0000045000

Explaining Example -

  • SYSUT1 DD maps the input data set (MATEPK.IEBGENER.INPUTPS).
  • SYSUT2 DD defines the output partitioned data set (MATEPK.IEBGENER.OUTPDS).
  • SYSIN DD defines the control data set.
  • GENERATE MAXNAME=1,MAXGPS=1 indicates a maximum of one names and on IDENTs are included in subsequent MEMBER statements.
  • MEMBER NAME=MEMBER1 names the first member as MEMBER1.
  • RECORD IDENT=(5,'E0005',1) copies the records upto 'E0005' from the beginning to MEMBER1.