Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Looping in JCL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 5:40 pm    Post subject: Looping in JCL
Reply with quote

Hi..I am new to rexx and looping..I am trying to build a JCL using SORT BUILD. The sort mentioned above is in a loop. The issue that i am not able to resolve is how can I get the GDG version and the job name incremented in the JCL.

> Using ICETOOL to get the count from a previous step
> Using the count in REXX to loop and submit jobs depending on the count
> The program in the job takes GDG versions as input
> I want to make the job card and the GDG version dynamic based on the count that i get from STEP 1.

Job1 I/P File xyz(0)
Job2 I/P File xyz(1)

First ever post to the forum. Please be kind..
Back to top
View user's profile Send private message

prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 5:44 pm    Post subject:
Reply with quote

I want to run all those jobs parallel but not able to as the job names are the same and the files are getting held up.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 726
Location: Maryland

PostPosted: Tue Feb 11, 2020 6:33 pm    Post subject:
Reply with quote

If you really need to get some help, please, try to formulate your task, and your goal in such a manner for others to be able to understand something.

One more thing is absolutely necessary: REAL EXAMPLES OF WHAT YOU HAVE TRIED SO FAR?

Don't forget about the "code tags", too.
Back to top
View user's profile Send private message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 6:41 pm    Post subject:
Reply with quote

Code:
OPTION COPY                                                           
 OUTFIL REMOVECC,                                                     
 HEADER1=('//Y4453RR3 JOB (METR4453,2000),''LOOP  JOB'', ',/,         
          '//          CLASS=D,MSGCLASS=H,NOTIFY=&SYSUID',/,           
          '//STEP01   EXEC PGM=IEBGENER',/,                           
          '//SYSPRINT DD SYSOUT=*',/,                                 
          '//SYSIN    DD DUMMY',/,                                     
          '//SYSUT1   DD DATA,DLM=''$$''',/,                           
          '/*REXX*/'),                                                 
BUILD=(C' DO I = 1 TO ',1,2,65X),      - This will insert the count I got from the previous step                               
TRAILER1=(' ADDRESS TSO "SUBMIT ''SS4453.TSUO4OZ.JCL(G4453RC7)''"',/,  - To submit the 2nd job
           ' 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,DSORG=PS)',/,     
'//STEP02  EXEC PGM=IKJEFT1A,DYNAMNBR=200',/,             
 '//SYSPROC  DD DSN=&&TEMP(TESTIT),',/,                   
 '//            DISP=(OLD,DELETE,DELETE)',/,               
 '//SYSPRINT DD SYSOUT=*',/,                               
 '//SYSTSPRT DD SYSOUT=*',/,                               
 '//SYSTSIN  DD *',/,                                     
 '%TESTIT                                   ',/,           
 '/*',/,                                                   
'//STEP00   EXEC PGM=IEFBR14',/,                           
'//SYSOUT   DD SYSOUT=*',/,                               
'//SYSUT2   DD DSN=SS4453.TSUO4OZ.GDG.SAMPLE(+1),',/,     
'//         DISP=(NEW,CATLG,DELETE)',/,                   
'//SYSIN    DD DUMMY')                     

Here I was testing the sequence of the jobs so had used +1 in SYSUT2.
Code:
//STEP01   EXEC PGM=B4453SRC                                   
//*                                                             
//KEYFILE  DD DSN=B4453.G4453RC3.TOKEN.FND.TEMP,DISP=SHR       
//CLMFILEI DD DSN=SS4453.TSUO4OZ.GDG.SAMPLE(0),DISP=SHR         
//CLMFILEO DD DSN=B4453.G4453RC4.VSAMO.TEMP,                   
//            DISP=(NEW,CATLG),                                 
//            DCB=(LRECL=32720,RECFM=FB,BLKSIZE=0),             
//            SPACE=(CYL,(100,100),RLSE)                       
//*           UNIT=TAPE                                         
//SYSOUT DD SYSOUT=*                                           
//SYSDBOUT DD   SYSOUT=*                                       
//SYSABOUT DD   SYSOUT=*                                       
//SYSPRINT DD   SYSOUT=*                                       
This is the second JCL. Here in CLMFILEI, I want to use the loop’s counter from the previous job. Also, if possible, the 2nd job’s jobname dynamic so that I can run these in parallel.

You were specifically asked to use the code tags when presenting what you have tried - you did not. Done for you THIS TIME. Do it yourself in future.
Back to top
View user's profile Send private message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 6:43 pm    Post subject:
Reply with quote

The entire part of the first job is in sort build as it would let me use the count to decide how many times the loop needs to run.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Tue Feb 11, 2020 7:33 pm    Post subject: Reply to: Looping in JCL
Reply with quote

Clear as mud - but why not have a Rexx program that reads in the count, loops count times producing count jobs?
Why does your IEFBR24 have SYSOUT and SYSIN? iEFBR14 does noting - reads nothing and writes nothing so needs no DD Names.
Presumably you mean 'generations' not 'versions'? 'versions' relate to the verion number that comes after the V (for Version) in GxxxxVyy.
Another thing - your topic title is 'Looping in JCL'. 2 things wrong here. 1 - JCL has no loop facility and, 2 - what you are talking about seems to be something completely different.
Back to top
View user's profile Send private message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 7:58 pm    Post subject:
Reply with quote

Thanks for helping me out with the code tags. Will keep that in mind in the future.

Why does your IEFBR24 have SYSOUT and SYSIN? iEFBR14 does noting - reads nothing and writes nothing so needs no DD Names.
Presumably you mean 'generations' not 'versions'? 'versions' relate to the verion number that comes after the V (for Version) in GxxxxVyy.
Another thing - your topic title is 'Looping in JCL'. 2 things wrong here. 1 - JCL has no loop facility and, 2 - what you are talking about seems to be something completely different.

IEFBR14 was just set to identify which generation gets generated at which sequence. It serves no purpose. Was used only for testing.

Looping in JCL is not possible. But I wanted to submit a job by incrementing a few variables. The jobcard in the second job has to get dynamically defined and also the input file of the second job takes the versions of the GDG.

but why not have a Rexx program that reads in the count, loops count times producing count jobs?

any examples that i could use. I am not able to visualize it. Sorry.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 726
Location: Maryland

PostPosted: Tue Feb 11, 2020 8:20 pm    Post subject:
Reply with quote

prowlersden wrote:
Thanks for helping me out with the code tags. Will keep that in mind in the future.

Why does your IEFBR24 have SYSOUT and SYSIN? iEFBR14 does noting - reads nothing and writes nothing so needs no DD Names.
Presumably you mean 'generations' not 'versions'? 'versions' relate to the verion number that comes after the V (for Version) in GxxxxVyy.
Another thing - your topic title is 'Looping in JCL'. 2 things wrong here. 1 - JCL has no loop facility and, 2 - what you are talking about seems to be something completely different.

IEFBR14 was just set to identify which generation gets generated at which sequence. It serves no purpose. Was used only for testing.

Looping in JCL is not possible. But I wanted to submit a job by incrementing a few variables. The jobcard in the second job has to get dynamically defined and also the input file of the second job takes the versions of the GDG.

but why not have a Rexx program that reads in the count, loops count times producing count jobs?

any examples that i could use. I am not able to visualize it. Sorry.


Absolute mess; even worse than the original post... icon_evil.gif

Before coding anything, please, try to explain in plain English: what is your goal, at all???!!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Feb 11, 2020 8:53 pm    Post subject:
Reply with quote

Quote:
I want to run all those jobs parallel but not able to as the job names are the same and the files are getting held up.
Have you discussed this with your site support group? Many sites limit the number of jobs for different job classes, and if you're running your jobs in such a job class, JES will limit the number of jobs that can run in parallel -- even if the job names are all unique.
Back to top
View user's profile Send private message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 9:00 pm    Post subject:
Reply with quote

Issue- I have a file that contains distinct filenames. Each filename needs to be passed to a different job that will call a COBOL program. Based on the count of distinct filenames, the REXX program will loop and call the second JCL, that contains the COBOL program.
Each version of the GDG will contain 1 of the filenames. These filenames will be passed to the DD statement of the COBOL step in the second JCL.

Requirement-
The first job will call the second JCL N times (N being the number of distinct files). This part has been completed. The part where I am stuck at is the point where I am not able to autoincrement the GDG version number in the second JCL. I want the second JCL to read the subsequent versions based on the counter.
The other issue that I am encountering is that I am not able to put different jobnames in the job card. The second JCL is getting triggered N times, but due to name contention, its getting held.

I am preparing the JCL's using sort build and passing the count from the input file.

I apologize if I am not clear as its my first time approaching a problem like this.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Tue Feb 11, 2020 10:01 pm    Post subject: Reply to: Looping in JCL
Reply with quote

I understand that you have a dataset (not a file) which, itself, contains a list of dataset names. Theses datasets have to be processed by a cobol program in a job - a separate job for each dataset.

Where does this list of dataset names come from? Why can the scheduler not submit the appropriate job to process the dataset when that dataset is created? Schedulers can do this.

Is it the same cobol program for each dataset?
Back to top
View user's profile Send private message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 10:14 pm    Post subject:
Reply with quote

I am getting the datasets name as an output of a cobol program. This cobol program reads a table and fetches the dataset names based on a query. These datasets are varying and not always fixed and due to this, the entire thing has to be dynamic.

Same cobol program for each dataset, yes.

A fixed number of filenames wouldn't have been an issue..
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 726
Location: Maryland

PostPosted: Tue Feb 11, 2020 10:26 pm    Post subject:
Reply with quote

Using the SORT utility to dynamically create temporary REXX code, and to substitute loop limit as a constant - it's the top of senseless activity I've ever seen in my life.

JCL code cannot be "called" at all, especially "called from another JCL code". This is absolute bullshit. Any JCL can only be submitted.

1) Use once-prepared REXX code which takes the list of required datasets from its input (and easily counts them, without any parameter).

2) Within this REXX code, dynamically re-allocate every new dataset name with the same DD name, and dynamically call the required COBOL module form this internal REXX loop.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Tue Feb 11, 2020 10:27 pm    Post subject: Reply to: Looping in JCL
Reply with quote

Seems like a simple rexx program that reads a dataset name from the input dataset, generates a job id, input dataset and output generation and then updates a skeleton JCL, submits it and then reads the next dataset name and repeats the process.

Ideally you would use file tailoring services.
Back to top
View user's profile Send private message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 10:32 pm    Post subject:
Reply with quote

Any examples please? I checked the other pages in the forum but wasn't able to get it.. i am new to rexx so need some guidance..
Back to top
View user's profile Send private message
prowlersden

New User


Joined: 11 Feb 2020
Posts: 9
Location: India

PostPosted: Tue Feb 11, 2020 10:36 pm    Post subject:
Reply with quote

I understand it would be very simple but it's the first time i am working on something related to rexx and noone in my group is aware of all the functionalities
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 726
Location: Maryland

PostPosted: Wed Feb 12, 2020 6:29 pm    Post subject:
Reply with quote

prowlersden wrote:
Any examples please? I checked the other pages in the forum but wasn't able to get it.. i am new to rexx so need some guidance..

This group supposed to clarify some tricky moments to the people who have seen mainframe more than once in their life, and not only to play computer games.

If you actually have no idea about designing, coding, and debugging algorithms (whatever language/tool is used, it doesn't matter) - then you need two steps first of all:
1) attend training classes, like "Basic Principles of Software Development"
2) visit the parallel Beginners Forum for mainframers.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Wed Feb 12, 2020 9:27 pm    Post subject: Reply to: Looping in JCL
Reply with quote

Also: skim-read the Rexx Language Reference manual (you will not need most of it for this problem), refer to z/OS TSO/E REXX User's Guide for info on EXECIO and z/OS ISPF Dialog Developer's Guide and Reference for information on file tailoring.

Also, chat to your system programmers - they are probably fluent in Rexx.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2174
Location: Silicon Valley

PostPosted: Thu Feb 13, 2020 4:14 am    Post subject: Reply to: Looping in JCL
Reply with quote

note: I have never used GDGs! But I recall something about the value of the current generation is not updated until after the job is completed (or something like that)

I do not think you can build a job then build another job and have it use a different generation. If I were you, I would not use a GDG at all. If you are building the JCL yourself, just use a data set name where the name contains the date, the time and a sequence number. Increment the sequence number for each iteration of the loop.

example (untested):
Code:
seq# = 0
time# = '.D' || right(DATE(’S’),7) ||,
        '.T' || TIME('s') ||,
        '.S'

Do n = 1 to mylimit
  seq# = seq# + 1
  CLMFILEI = 'SS4453' || time# || right(seq#,7,'0')
   /* other processing*/
End
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 340
Location: Denmark

PostPosted: Thu Feb 13, 2020 2:58 pm    Post subject:
Reply with quote

Quote:
the value of the current generation is not updated until after the job is completed

is true, the way around is to increase the number during the job, i.e.
step1 use gdg.dsn(+1)
step2 use gdg.dsn(+2)
etc.
I have used GDGs a lot and I like them, mostly because they are self-cleaning - obsolete datasets are automatically deleted. But yes there are drawbacks too.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Looping in JCL anilkumar922 JCL & VSAM 7 Tue Feb 25, 2020 7:18 pm
No new posts Looping REXX - unable to interrupt RAVISANKAR07 CLIST & REXX 3 Wed Dec 06, 2017 1:08 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts Looping in REXX and pass data to JCL. PeterHolland CLIST & REXX 24 Wed Jan 11, 2012 6:08 pm
No new posts JOIN UNPAIRED looping with 3 key fiel... madmartinsonxx DFSORT/ICETOOL 7 Thu Jul 21, 2011 7:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us