IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Looping in JCL


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

New User


Joined: 27 Jun 2016
Posts: 13
Location: india

PostPosted: Tue Feb 25, 2020 7:18 pm
Reply with quote

Hi All,
I've one requirement like based on no.of records in file, i need to execute next step that many times.

For Ex: if my file has 2 records, then next step should execute two times. if it has one then it should execute only 1 time.

Please let me know how we can achieve this scenario?


Thanks in Advance.
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 397
Location: Denmark

PostPosted: Tue Feb 25, 2020 7:38 pm
Reply with quote

You can't, you will need a program to do that.
Back to top
View user's profile Send private message
anilkumar922

New User


Joined: 27 Jun 2016
Posts: 13
Location: india

PostPosted: Tue Feb 25, 2020 7:42 pm
Reply with quote

You mean REX program?
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 397
Location: Denmark

PostPosted: Tue Feb 25, 2020 7:46 pm
Reply with quote

No, I mean a program, whatever you prefer - Asembler, COBOL, PL/I, REXX.....
Back to top
View user's profile Send private message
anilkumar922

New User


Joined: 27 Jun 2016
Posts: 13
Location: india

PostPosted: Tue Feb 25, 2020 7:55 pm
Reply with quote

Thanks Willy Jensen.

Could you please give me outline how we can implement this logic in COBOL.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2432
Location: Hampshire, UK

PostPosted: Tue Feb 25, 2020 9:03 pm
Reply with quote

We are not here to design things for you. Get together with your team lead to discuss and design. Hint: internal reader.
Back to top
View user's profile Send private message
anilkumar922

New User


Joined: 27 Jun 2016
Posts: 13
Location: india

PostPosted: Tue Feb 25, 2020 9:13 pm
Reply with quote

Thanks Nic for your valuable suggestion.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1226
Location: Vilnius, Lithuania

PostPosted: Wed Feb 26, 2020 4:05 am
Reply with quote

REXX would seem the logical choice, been there, done that when a regression testing job became so large that it exceeded the very hard limit of 255 steps in a job. The job now has a single step running a REXX exec that loops around, and gets its parameters from the name(!) of a JCL file, the job is submitted by an edit macro that dynamically changes this dsname.
Back to top
View user's profile Send private message
tatasteed

New User


Joined: 18 Sep 2007
Posts: 8
Location: Santiago de Chile

PostPosted: Fri Jun 05, 2020 5:56 am
Reply with quote

You can do it by means of an instream proc.
You just need to pass the parameters to the instream proc by means of an include call (I have done so a few times).
Using sort is a good way to build the include.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8793
Location: Welsh Wales

PostPosted: Fri Jun 05, 2020 2:08 pm
Reply with quote

I have used a REXX EXEC which reads each record, in this case it was about 80 bytes, and passed it as a parameter into a program called by REXX.

So for every record read the program was invoked.
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

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Looping in JCL CLIST & REXX 20
No new posts Looping REXX - unable to interrupt CLIST & REXX 3
No new posts Replace repeated JCL with looping REXX CLIST & REXX 3
No new posts Looping in REXX and pass data to JCL. CLIST & REXX 24
No new posts JOIN UNPAIRED looping with 3 key fiel... DFSORT/ICETOOL 7

Back to Top