IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Creating Dynamic JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Nov 13, 2007 7:00 pm
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

Global Moderator


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

PostPosted: Tue Nov 13, 2007 7:03 pm
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
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
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

Global Moderator


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

PostPosted: Tue Nov 13, 2007 9:33 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Creating Unix Directory using COBOL i... COBOL Programming 2
No new posts Creating Report using SORT DFSORT/ICETOOL 7
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
Search our Forums:

Back to Top