How to populate a new DATASET in JCL?

JES2/3, JCL, utilities.
Post Reply
peeterjoot
Registered Member
Posts: 15
Joined: Fri Mar 03, 2017 2:01 am
Contact:

How to populate a new DATASET in JCL?

Post 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?
User avatar
Akatsukami
Global Moderator
Global Moderator
Posts: 122
Joined: Tue Oct 20, 2015 3:20 am
Location: Bloomington, IL
Contact:

Re: How to populate a new DATASET in JCL?

Post by Akatsukami »

You need to create it in a step running some program (e.g., *Sort) that writes to it.
"I come to the conclusion that, men loving according to their own will and fearing according to that of the prince, a wise prince should establish himself on that which is in his own control and not in that of others." -- Niccolò Machiavelli
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: How to populate a new DATASET in JCL?

Post by Robert Sample »

You can use the IDCAMS REPRO command to copy data into the new dataset.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: How to populate a new DATASET in JCL?

Post 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)
/* 
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”