Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Creating Dynamic JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Arloni

New User


Joined: 12 Nov 2007
Posts: 4
Location: Brasil

PostPosted: Tue Nov 13, 2007 6:52 pm    Post subject: Creating Dynamic JCL
Reply with quote

Hi. I need to create an JCL to be put on production that has in it references to datasets that I will inform just on submission time.
Explaining better:

There is a process that we run manually that pickup some backup files and do some processing with them. Today this is a manual processing, and we are trying to automate it, puting in the right sequence all jobs that invoke manually. The only issue here is that, before running this process, we do some research to get the right version of the GDGs that will be used in this process.

This job is going to be put in production environment, so this is the reason we cannot modify it every time we will need to run it, but somehow we need to inform the list of datasets to be used in a common file or control card that can be modified, and pickup this list of dataset to be used in the subsequent steps.

Ex.:

//STEP1 .... Read a control card/dataset with 4 input files
//STEP2 EXEC PGM=SORT
//SORTIN DD DSN=&INPUT FILE 1 OF DATASET <= This line cannot be changed in the JCL
...
//STEP3 EXEC PGM=SORT
//SORTIN DD DSN=&INPUT FILE 2 OF DATASET <= This line cannot be changed in the JCL
...

So, in summary, how reference a dataset name in a input dataset/control card and use it internaly in a JCL? The idea is to not modify the JCL, but the dataset/control card that has the real names of the input datasets, read it and use it in the other programs the JCL invokes.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Nov 13, 2007 7:00 pm    Post subject: Reply to: Dynamic JCL
Reply with quote

Any reason not to make it a proc whit as many parameters as You need ??

Code:
//jobname JOB job_info
//*
//p1 EXEC procname,
//    DSN1=dataset_1
//    ....
//    DSNn=dataset_n


and in a pds available as a proclib ( jes2 / jcllib )

Code:
//procname PROC
//STEP1 EXEC PGM=SORT
//SORTIN DD .....,DSN=&DSN1 
...
//STEP2 EXEC PGM=SORT
//SORTIN DD .....,DSN=&DSN2
...
...
...
//STEPn EXEC PGM=SORT
//SORTIN DD .....,DSN=&DSNn
...

Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Nov 13, 2007 7:03 pm    Post subject: Reply to: Dynamic JCL
Reply with quote

Keep in mind that you're talking about JCL here. When the job is submitted, and is being scanned and placed onto the JES Internal Reader for execution, all of the dataset references are resolved, any variable fields are substituted, all before the job ever starts. Nothing can be changed once the job has started execution.

What you're looking to do is going to have to be done within an application program using dynamic file allocation routines (i.e. SVC99 or BPXWDYN or TSO ALLOC), or your job IS going to have to generate and then submit other jobs dynamically.
Back to top
View user's profile Send private message
Karthigaiselvan

New User


Joined: 11 Dec 2006
Posts: 35
Location: India

PostPosted: Tue Nov 13, 2007 8:33 pm    Post subject: Reply to: Creating Dynamic JCL
Reply with quote

It's a good bet trying out the job posted in the below link.

http://www.ibmmainframes.com/viewtopic.php?t=25740&highlight=

How do you want to choose the files to be processed (manual or automatic?)

If manual, then this job will help you, you can pass the files list in a control card and have the job run.

If automatic, then we may need to know what are the conditions on which the files are chosen.
Back to top
View user's profile Send private message
Arloni

New User


Joined: 12 Nov 2007
Posts: 4
Location: Brasil

PostPosted: Tue Nov 13, 2007 9:14 pm    Post subject:
Reply with quote

Just adding information, the idea is to modify only a control card or dataset with the dataset list that is going to be processed by that JCL and ask the operator to start it.

The JCL is going to be the automated part of the process, but for each different request, the list of DATASETS is going to be diferent. That is why we would like to separate the names of the datasets in a file that we can change anytime we want, but the JCL has to be smart enough to open that file, pick up the datasets names and process them as usual. As it is going to run on production environment, we CAN NOT change it every time we need to run that adhoc process, but it will read that file that we can modify as desired.

So how can I refer the contents of a live dataset into a JCL, in manner that the first line of that file is the DATASET 1 that is going to be used in a SORT step, for example, and line 2 is the DATASET 2 that is going to be an input of DB2 program, and so forth? At each run, I just need to infom the right dataset names, and the JCL does the proper translations, refering those datasets names that are in that file?
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Nov 13, 2007 9:33 pm    Post subject: Reply to: Creating Dynamic JCL
Reply with quote

Is there a reason why using INCLUDE and SET statements hasn't worked? For example:

The PDS 'HLQ.PDS', which is manually controlled, contains the member 'X' with these four statements:

// SET DATASET1=HLQ.DATASET1
// SET DATASET2=HLQ.DATASET2
// SET DATASET3=HLQ.DATASET3
// SET DATASET4=HLQ.DATASET4

Then, the job uses the PDS to define the datasets used during run-time:

//MYJOB JOB (....),CLASS=X,MSGCLASS=X
//*
// JCLLIB ORDER=HLQ.PDS
// INCLUDE MEMBER=X
//*
...
//SORTIN DD DSN=&DATASET1,DISP=SHR
...
//SORTIN DD DSN=&DATASET2,DISP=SHR
...
//SORTIN DD DSN=&DATASET3,DISP=SHR
...
Back to top
View user's profile Send private message
Arloni

New User


Joined: 12 Nov 2007
Posts: 4
Location: Brasil

PostPosted: Tue Nov 13, 2007 9:37 pm    Post subject:
Reply with quote

Thank you all for the quick response.
Kevin, I will try to apply your solution and let you know.
Thanks a lot and kind regards,
Arloni.
Back to top
View user's profile Send private message
Arloni

New User


Joined: 12 Nov 2007
Posts: 4
Location: Brasil

PostPosted: Tue Nov 13, 2007 10:02 pm    Post subject: Re: Reply to: Creating Dynamic JCL
Reply with quote

superk wrote:
Is there a reason why using INCLUDE and SET statements hasn't worked? For example:

The PDS 'HLQ.PDS', which is manually controlled, contains the member 'X' with these four statements:

// SET DATASET1=HLQ.DATASET1
// SET DATASET2=HLQ.DATASET2
// SET DATASET3=HLQ.DATASET3
// SET DATASET4=HLQ.DATASET4

Then, the job uses the PDS to define the datasets used during run-time:

//MYJOB JOB (....),CLASS=X,MSGCLASS=X
//*
// JCLLIB ORDER=HLQ.PDS
// INCLUDE MEMBER=X
//*
...
//SORTIN DD DSN=&DATASET1,DISP=SHR
...
//SORTIN DD DSN=&DATASET2,DISP=SHR
...
//SORTIN DD DSN=&DATASET3,DISP=SHR
...



Thanks a lot! It was exactly what I was looking for! Many thanks!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Creating an 'Enter' event with IMS MF... dileep chirasani Java & MQSeries 1 Sat Aug 06, 2016 2:23 am
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us