View previous topic :: View next topic
|
Author |
Message |
bobbynov201
New User
Joined: 06 Aug 2007 Posts: 12 Location: bangalore
|
|
|
|
Hi,
Is there anyway that we can run a JCL for "n" number of times.
Say, suppose I have a file in which I have data as "10". Passing this file as i/p to the JCL, can we run the same JCL for 10 times?
Please update me on this, if anyone worked on this.
Thanks,
Sunil. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Rather what you should do is ..
run one job which reads file and does some task those many times... |
|
Back to top |
|
|
bobbynov201
New User
Joined: 06 Aug 2007 Posts: 12 Location: bangalore
|
|
|
|
Hi,
If you dont mind, could you please explain this in little detail.
Because, my requirement is I should run the same steps again and again with submitting that JCL.
Thanks,
Sunil. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
JCL cannot loop - you can copy your "JCL" in a PROC and execute that 10 times in your Job. |
|
Back to top |
|
|
bobbynov201
New User
Joined: 06 Aug 2007 Posts: 12 Location: bangalore
|
|
|
|
Thanks Anuj,
I will try that option, but one last question. I am not sure of the process of executing PROCs "n" number of times. So, if you have any sample JCL step could you please give me here.
Thanks,
Sunil. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
The number of times the proc is executed would be set at the time the jcl is submitted. You loop in programs not in JCL. I would suggest you talk with someone that knows a little about how mainframe jobs are setup and excuted before you go any farther with you misdirected project. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Is there anyway that we can run a JCL for "n" number of times.
Say, suppose I have a file in which I have data as "10". Passing this file as i/p to the JCL, can we run the same JCL for 10 times? |
ABSOLUTELY, CATEGORICALLY THIS CANNOT BE DONE.
JCL cannot loop, period. It executes the first step, tests the condition code(if applicable) to determine whether to execute the second step, tests the condition code (if applicable) to determine whether to execute the third step, and repeat for however many steps of JCL there are.
You can either submit the job N times or you can report back to whoever gave you this ridiculous assignment and tell them it cannot be accomplished. If the JCL is in a PROCLIB, you can execute the PROC N times but again there's no looping involved -- the JCL must have N EXEC statements, one for each PROC to be executed. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
bobbynov201 wrote: |
I will try that option, but one last question. I am not sure of the process of executing PROCs "n" number of times. So, if you have any sample JCL step could you please give me here. |
There is no such logic - JCL will execute from - top to down, no so called, looping is involved.
I said, write your statements in a PROC and execute the PROC 10-times and you write 10 EXECs for that, as Robert has mentioned.
And I'm not sure - why this question comes around so often, think for a second why the JCL, the batch process was evolved actually and all will be revealed. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Theoretically you could replace the JCL with an equivalent Rexx procedure and do all the looping you want. But I don't recommend it because it would take a lot of work and would probably never be accepted by Operations for use in production. |
|
Back to top |
|
|
bobbynov201
New User
Joined: 06 Aug 2007 Posts: 12 Location: bangalore
|
|
|
|
Thanks a lot everyone for the inputs provided.
Sunil. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Hello,
The below JCL submits the JOB inside "WELLS.GREEN.DAY(DFSORT)" 4 times.
Code: |
//COPYREXX EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DATA,DLM='$$'
/*REXX*/
DO I = 1 TO 4 /*NUMBER OF TIMES THE JOB NEEDS TO BE RUN */
ADDRESS TSO "SUBMIT 'WELLS.GREEN.DAY(DFSORT)'"
END
EXIT 0
$$
//SYSUT2 DD DSN=&&TEMP(TESTIT),DISP=(NEW,PASS,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(1,1,20),RLSE),
// DCB=(BLKSIZE=6160,LRECL=80,RECFM=FB,DSORG=PS)
//*
//JOBSTEP1 EXEC PGM=IKJEFT1A,DYNAMNBR=200
//SYSPROC DD DSN=&&TEMP(TESTIT),DISP=(OLD,DELETE,DELETE)
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
%TESTIT
/* |
I will leave the "reading a control file and populating the '4' value part" for you to experiment.
Hope it helps. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
bobbynov201
New User
Joined: 06 Aug 2007 Posts: 12 Location: bangalore
|
|
|
|
Thanks everyone for the suggestions.
Regards,
Sunil. |
|
Back to top |
|
|
|