Split PS file into PDS Members Example


Scenario - Split sequential file records into three new PDS members.

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----+
//MATEPKE  JOB (123),'MTH',CLASS=A,MSGCLASS=A,
//             MSGLEVEL=(1,1),NOTIFY=&SYSUID
//******************************************************
//* SPLIT SEQUENTIAL FILE RECORDS INTO DIFFERENT MEMBERS
//******************************************************
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPDS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10,10),RLSE),
//            VOL=SER=DEVHD4,UNIT=3390,
//            DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD  *
  GENERATE MAXNAME=3,MAXGPS=2
     EXITS IOERROR=ERRORRT
    MEMBER NAME=MEMBER1
    RECORD IDENT=(5,'E0003',1)
    MEMBER NAME=MEMBER2
    RECORD IDENT=(5,'E0005',1)
    MEMBER NAME=MEMBER3
/*

Output1 - MATEPK.IEBGENER.OUTPDS(MEMBER1)

 =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

Output2 - MATEPK.IEBGENER.OUTPDS(MEMBER2)

 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000004 E0004    EMPLOYEE4           TL        DEPT1     LOC1      0000050000   
000005 E0005    EMPLOYEE5           SSE       DEPT1     LOC1      0000045000

Output3 - MATEPK.IEBGENER.OUTPDS(MEMBER3)

 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000006 E0006    EMPLOYEE6           SE        DEPT1     LOC1      0000034000   
000007 E0007    EMPLOYEE7           SSE       DEPT2     LOC2      0000046000

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 card.
  • GENERATE MAXNAME=3,MAXGPS=2 indicates a maximum of three names and two IDENTs are included in subsequent MEMBER statements.
  • EXITS IOERROR=ERRORRT define the user routines to process user label for the IOERROR.
  • MEMBER NAME=MEMBER1 names the first member as MEMBER1.
  • RECORD IDENT=(5,'E0003',1) copies the records upto 'E0003' from the beginning to MEMBER1.
  • MEMBER NAME=MEMBER2 names the second member as MEMBER2.
  • RECORD IDENT=(5,'E0005',1) copies the records after 'E0003' until 'E0005' to MEMBER2.
  • MEMBER NAME=MEMBER2 names the third member as MEMBER3 and copies the records after 'E0005' until end because no RECORD IDENT statement coded.