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

Dynamic JCL execution


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bobbynov201

New User


Joined: 06 Aug 2007
Posts: 12
Location: bangalore

PostPosted: Wed Apr 13, 2011 4:47 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Apr 13, 2011 4:51 pm
Reply with quote

Rather what you should do is ..

run one job which reads file and does some task those many times...
Back to top
View user's profile Send private message
bobbynov201

New User


Joined: 06 Aug 2007
Posts: 12
Location: bangalore

PostPosted: Wed Apr 13, 2011 4:58 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Apr 13, 2011 4:58 pm
Reply with quote

JCL cannot loop - you can copy your "JCL" in a PROC and execute that 10 times in your Job.
Back to top
View user's profile Send private message
bobbynov201

New User


Joined: 06 Aug 2007
Posts: 12
Location: bangalore

PostPosted: Wed Apr 13, 2011 5:03 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Apr 13, 2011 5:15 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8651
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 13, 2011 5:29 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Apr 13, 2011 5:43 pm
Reply with quote

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
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 742
Location: Whitby, ON, Canada

PostPosted: Wed Apr 13, 2011 5:51 pm
Reply with quote

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
View user's profile Send private message
bobbynov201

New User


Joined: 06 Aug 2007
Posts: 12
Location: bangalore

PostPosted: Wed Apr 13, 2011 6:00 pm
Reply with quote

Thanks a lot everyone for the inputs provided.

Sunil.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1691
Location: Tiruppur, India

PostPosted: Wed Apr 13, 2011 6:06 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed Apr 13, 2011 6:53 pm
Reply with quote

Sunil, we already went over this concept in your other topic:

www.ibmmainframes.com/viewtopic.php?t=54018&highlight=

let's stop re-hashing the same issue and move on.
Back to top
View user's profile Send private message
bobbynov201

New User


Joined: 06 Aug 2007
Posts: 12
Location: bangalore

PostPosted: Mon Apr 18, 2011 2:35 pm
Reply with quote

Thanks everyone for the suggestions.

Regards,
Sunil.
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 Dynamic file allocation using JCL JCL & VSAM 8
No new posts Dynamic Sortin DD cards SYNCSORT 8
No new posts SORT for dynamic trailer record + CSV... DFSORT/ICETOOL 14
No new posts Parallel Sysplex - subprogram execution CICS 7
No new posts Dynamic condition checks COBOL Programming 5
Search our Forums:

Back to Top