Page 1 of 1

How to populate a new DATASET in JCL?

Posted: Mon Mar 06, 2017 11:58 pm
by peeterjoot
If I allocate a DATASET in JCL, either manually, or with IDCAMS, such as:

Code: Select all

//VSAMCR JOB 
//DEFINE EXEC PGM=IDCAMS 
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSTERM  DD SYSOUT=*
//SYSIN DD * 
DEFINE CLUSTER (NAME(PJVSAM00.00000000) -
               CYLINDERS(1) VOLUMES(LZ0000) -
               INDEXED KEYS(10 179) -
               RECORDSIZE(240 240) -
               ) -
         DATA (NAME(PJVSAM00.00000000.DATA)) -
         INDEX (NAME(PJVSAM00.00000000.INDEX))
/*
How can I populate that file with some initial content, such as that from an INLINE DD, like SYSIN above, so that I can use that file in a subsequent JCL step?

Re: How to populate a new DATASET in JCL?

Posted: Tue Mar 07, 2017 12:32 am
by Akatsukami
You need to create it in a step running some program (e.g., *Sort) that writes to it.

Re: How to populate a new DATASET in JCL?

Posted: Tue Mar 07, 2017 12:45 am
by Robert Sample
You can use the IDCAMS REPRO command to copy data into the new dataset.

Re: How to populate a new DATASET in JCL?

Posted: Tue Mar 07, 2017 10:38 am
by Anuj Dhawan
As has been said, REPRO has been favorite when it comes to VSAM:

Code: Select all

//COPYDATA ,'job-name',CLASS=class,TIME=(mm,ss)
// EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=class-name
//indd  DD DSN= ... (the input data set)
//outdd DD DSN= ... (the output data set)
//SYSIN DD *
REPRO -
  INFILE(indd) -
  OUTFILE(outdd)
/*