How to copy a VSAM file to a PS in JCL

Copying a VSAM file into a PS (Physical Sequential) file can be done using the following methods with Examples.

1. Using IDCAMS Repro

This is the most frequently suggested method for any VSAM files related tasks. So for copying VSAM to PS also, REPRO can be used.

//***************************************************
//* REPRO CUST FILE TO A FLAT FILE
//***************************************************
//STEP01 EXEC PGM=IDCAMS,COND=(0,NE)
//INDS DD DSN=CUST.REGPRD.CST02.CL,DISP=SHR
//OUTDS DD DSN=CUST.TEMP.CST02.FLT,
// DISP=(NEW,CATLG,KEEP),
// UNIT=PRD11,SPACE=(CYL,(30,10),RLSE),
// DCB=(RECFM=FB,LRECL=924,BLKSIZE=92400)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
REPRO INFILE(INDS) –
OUTFILE(OUTDS)
/*

– Here the In datset is the VSAM cluster, We need to give the Cluster name here not the Data component or Index component.
– Out dataset is the PS file to which the data are copied.

2. Using SORT

Most of the frequently used sorts like DFSORT and SYNCSORT supports the copy of a VSAM DATA SET into a PS.

//STEP02 EXEC PGM=SORT,COND=(0,NE)
//SYSOUT DD SYSOUT=*
//SORTWK01 DD SPACE=(CYL,(1,1),RLSE),UNIT=PROD1
//SORTWK02 DD SPACE=(CYL,(1,1),RLSE),UNIT=PROD1
//SORTIN DD DSN=CUST.PRD11.CLUSTER,DISP=SHR
//SORTOUT DD DSN=CUST.TEMP.FLT01,
// DISP=(NEW,PASS,DELETE),SPACE=(CYL,(10,1),RLSE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=50000)
//SYSIN DD *
OPTION COPY
//*

Here also the input VSAM dataset CLUSTER needs to be given in SORTIN and a flat file as the SORTOUT.

One Comment

Leave a Reply to rakesh Cancel reply

Your email address will not be published. Required fields are marked *

Close Bitnami banner