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.
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.
//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.
Joined: 26 Apr 2004 Posts: 4650 Location: Raleigh, NC, USA
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.
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?