Copy PS Data to fixed-length ESDS Example


Scenario - Copy the data from the PS file to fixed-length KSDS.

Scenario - Copy data from PS file to KSDS file.

Input PS File - MATEGJ.TEST.DATA

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEGJR JOB (123),'MTH',CLASS=A,MSGCLASS=A,
//             MSGLEVEL=(1,1),NOTIFY=&SYSUID
//**********************************************
//* LOADING DATA TO KSDS FROM PS(FLAT FILE)
//**********************************************
//STEP01   EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//INPUT    DD   DSN=MATEGJ.TEST.DATA,DISP=SHR
//OUTPUT   DD   DSN=MATEGJ.TEST.KSDS,DISP=SHR
//SYSIN    DD   *
      REPRO    -
           INFILE(INPUT)   -
           OUTFILE(OUTPUT)
/*

In the above JCL, MATEGJ.TEST.DATA is the flat file and MATEGJ.TEST.KSDS is the KSDS file.

Output -

Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, RRDS loaded successfully with records from the PS file.

loading KSDS Output

Verify the KSDS in 3.4 (Dataset List utility) or any File management tools.

loading KSDS Output

Explaining Example -

In the above example, all the records from the MATEGJ.TEST.DATA(flat file of length 47) file copied to MATEGJ.TEST.KSDS(KSDS file of length 47) file.

Note! The flat file(PS) and KSDS file should have the same record length(47 in the above example) to load the data successfully.