Executing JCL iterating through all members in a PDS
Moderators: Frank Yaeger, DikDude, Moderator Group
Executing JCL iterating through all members in a PDS
Hi There,
I require a favour on the below idea,
Requirement Description:
I would like to run a JCL which runs by iterating through all the members in the PDS given.
For Example:
JCL:
//JOB1 JOB 'IBM',CLASS=A,NOTIFY=&SYSUID
//STEP1 EXEC PGM1
//COBOL.SYSIN DD DISP=SHR,DSN=SAMPLE.PDS(MEM1)
//COBOL.SYSOUT DD DISP=NEW,DSN=SAMPLE.OUTPUT(+1)
......
//SYSPRING DD SYSOUT=*
Here the PDS "SAMPLE.PDS" consists of several other members like MEM2,MEM3,MEM4 etc... I would like to use the same jcl to execute
iterating through all members in the given PDS and resulting output to be stored in the GDG "SAMPLE.OUTPUT(+1)" for each execution.
Could someone help on this please?
Thanks!!!
I require a favour on the below idea,
Requirement Description:
I would like to run a JCL which runs by iterating through all the members in the PDS given.
For Example:
JCL:
//JOB1 JOB 'IBM',CLASS=A,NOTIFY=&SYSUID
//STEP1 EXEC PGM1
//COBOL.SYSIN DD DISP=SHR,DSN=SAMPLE.PDS(MEM1)
//COBOL.SYSOUT DD DISP=NEW,DSN=SAMPLE.OUTPUT(+1)
......
//SYSPRING DD SYSOUT=*
Here the PDS "SAMPLE.PDS" consists of several other members like MEM2,MEM3,MEM4 etc... I would like to use the same jcl to execute
iterating through all members in the given PDS and resulting output to be stored in the GDG "SAMPLE.OUTPUT(+1)" for each execution.
Could someone help on this please?
Thanks!!!
My first thought would be to setup the initial member name in an INCLUDEd library and use SET to make the member name a variable, i.e.
where the library member "MEM" is a SET statement:
// SET MEM='MEM1'
and then is included in the job
//JOB1 JOB 'IBM',CLASS=A,NOTIFY=&SYSUID
// JCLLIB ORDER=... (if necessary)
// INCLUDE MEMBER=MEM
...
//COBOL.SYSIN DD DISP=SHR,DSN=SAMPLE.PDS(&MEM)
and then I'd have a job step write the next member name to use into the library, and then re-submit the job. And so on until all of the members were accounted for.
<update>
Actually, even easier. Just use a JCL Procedure. Call the procedure once for each member needed, passing the member name and relative generation number as symbolic parameters.
where the library member "MEM" is a SET statement:
// SET MEM='MEM1'
and then is included in the job
//JOB1 JOB 'IBM',CLASS=A,NOTIFY=&SYSUID
// JCLLIB ORDER=... (if necessary)
// INCLUDE MEMBER=MEM
...
//COBOL.SYSIN DD DISP=SHR,DSN=SAMPLE.PDS(&MEM)
and then I'd have a job step write the next member name to use into the library, and then re-submit the job. And so on until all of the members were accounted for.
<update>
Actually, even easier. Just use a JCL Procedure. Call the procedure once for each member needed, passing the member name and relative generation number as symbolic parameters.
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
<Reply>MrSpock wrote:My first thought would be to setup the initial member name in an INCLUDEd library and use SET to make the member name a variable, i.e. where the library member "MEM" is a SET statement: // SET MEM='MEM1' and then is included in the job //JOB1 JOB 'IBM',CLASS=A,NOTIFY=&SYSUID // JCLLIB ORDER=... (if necessary) // INCLUDE MEMBER=MEM ... //COBOL.SYSIN DD DISP=SHR,DSN=SAMPLE.PDS(&MEM) and then I'd have a job step write the next member name to use into the library, and then re-submit the job. And so on until all of the members were accounted for. Actually, even easier. Just use a JCL Procedure. Call the procedure once for each member needed, passing the member name and relative generation number as symbolic parameters.
Thanks so much!
I would like to get more insight interms of the actual code to get better understanding. May i request you for the same?
JCL is a) site specific for things such as various jobcard parameters and sysout classes to be used and b) dependent on the program being executed and its requirements - datasets, space etc. As a result we cannot really give you assistance beyond saying - look at jobs that work in your installation, know which bits to change for your userid, know what programs you need to run, know which DDnames each program needs and which datasets need to be associated with each DDname. Syntax can be found in the JCL Language Reference manual and the JCL Users Guide.
Regards
Nic
Nic
-
- Member
- Posts: 8
- Joined: Wed Jan 25, 2012 6:55 pm
<Reply>NicC wrote:JCL is a) site specific for things such as various jobcard parameters and sysout classes to be used and b) dependent on the program being executed and its requirements - datasets, space etc. As a result we cannot really give you assistance beyond saying - look at jobs that work in your installation, know which bits to change for your userid, know what programs you need to run, know which DDnames each program needs and which datasets need to be associated with each DDname. Syntax can be found in the JCL Language Reference manual and the JCL Users Guide.
Thanks for the suggestions
<Reply>kiran.vits wrote:Hi Ramy,
can you explain whether your Requirement is to run all the jobs or running based on RC of previous job..
Rexx code can do better for this requirement..
Check for your requiremnet in REXX Section.. If you i not get the answer start a new post in REXX section.
Hi Nicc,
My requirement is to run all the jobs irrespective of the RC of the previous job. I shall check the same in REXX section.
Thaks for the suggestion
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page