Multiple Execution of a Proc

Question: I am using the code you supply for Creating a Job from a Program.
I want to put this step into a proc to execute a number of times.
anonymous

Answer: If you want the PROC in the JCL then just create it as follows adding as many EXEC SUB lines as you need to execute the number of copies of the step that you want. Each step will substitute a different filename into the JCL that executes (just substitute your values for the entries in lowercase):

//SUB PROC SFILE=,JCLASS=class
//SUB1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=&SFILE.,DISP=SHR
//SYSUT2 DD SYSOUT=(&JCLASS.,INTRDR)
//SYSIN DD DUMMY
//SUBEND PEND
//S1 EXEC SUB,JFILE=file1
//S2 EXEC SUB,JFILE=file2
//S3 EXEC SUB,JFILE=file3

You can substitute whatever JCL that you want to execute into the PROC and parameterize whatever you want by specifying the parameters (and any default values) on the PROC statement and by placing an ampersand in front and a period behind the parameter references in the PROC.

To place the PROC into a permanent PROC library instead of into the JCL just copy everything above the PEND statement into the PROC library and just include the statements following the PEND in your JCL.

If you want to dynamically create and execute this JCL from a program then just write this to a file out of the program and then in the following step of the job that executes the program call the PROC to submit the file containing this JCL.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate