JCL to build multiple jcl's using a template



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

JCL to build multiple jcl's using a template

Postby Surabhi » Tue Nov 08, 2016 11:41 am

Hi All,

I have a requirement to build multiple jcl's using a template.
I have a PDS with almost 50 members, what i need to do is build a template for the jcl and replace just the member name in the JCL template, so that my original jcl can build multiple jcl's.
I have the template ready with me. Can some one please guide me how can i build multiple JCL's .

Thank you.
Surabhi
 
Posts: 49
Joined: Thu Sep 10, 2015 7:51 pm
Has thanked: 4 times
Been thanked: 0 time

Re: JCL to build multiple jcl's using a template

Postby Aki88 » Tue Nov 08, 2016 12:01 pm

Hello,

A few queries:
a. Once the member name is overridden in 'the template', what do you want to do with it, before moving onto the next member?
b. Can you show us the template?

Depending upon your programming proficiency, choose any of the below options:
a. REXX - A small exec which will read the member names from the PDS containing your member and pad the member name as a symbolic to the 'template' which will be coded in REXX with QUEUE command; this can be routed to INTRDR using ISPF EDIT macro- SUBMIT. Look for 'how to get member list from PDS using REXX', quite a lot of examples here.
b. Using *SORT - Code your template using 'OUTFIL BUILD' and pass the member name of each member of your PDS using SYMNAMES; route the output as you may choose.
c. COBOL - Similar logic as REXX, though you'd need to be proficient in calling the ISPF services in COBOL, again, quite a few examples are available.
d. (I'd prefer this) ISPF File-Tailoring - This has been out there for a while and is really good once you get a hang of it. Refer this link for starters, once you've learnt how to use these services, you can build on this powerful tool.
--- and more options.

The choice and further code will again depend upon the primary questions.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: JCL to build multiple jcl's using a template

Postby Surabhi » Tue Nov 08, 2016 12:29 pm

Hi Aki88,

Once the member name is overridden in the template , it will move to the next member and once all the members are done i need to submit those jobs.
Can this be done using *SORT ?
For ispf FILE-TAILORING i went through the example you provied, but could not get much.

Thanks.
Surabhi
 
Posts: 49
Joined: Thu Sep 10, 2015 7:51 pm
Has thanked: 4 times
Been thanked: 0 time

Re: JCL to build multiple jcl's using a template

Postby Aki88 » Tue Nov 08, 2016 1:16 pm

Hello,

Surabhi wrote:... Once the member name is overridden in the template , it will move to the next member and once all the members are done i need to submit those jobs. ...


If job submission is what you want to achieve, why not submit it asa the template is updated for each member name? If the template is a simple JCL as the example below, then simply update the member name and route the output to INTRDR (JCL lines for this are commented in the example).


// SET SEG='0',                                                        
//     LIBRARY1='(TEST.LIB1,',                                        
//     LIBRARY2='TEST.LIB2),',                                        
//     MEMLIB='MYPDSMEM'                                              
//*                                                                    
//STEP001  EXEC PGM=SORT,COND=(0,NE),                                  
//            PARM='JP1"&SEG",JP2"&LIBRARY1",JP3"&LIBRARY2",JP5"&MEMLIB
//             "'
                                                     
//SYSOUT   DD SYSOUT=*                                                
//SYMNOUT  DD SYSOUT=*                                                
//SORTIN   DD DUMMY,DCB=(RECFM=FB,LRECL=80)                            
//SORTOUT  DD SYSOUT=*                                                
//*SORTOUT  DD SYSOUT=(A,INTRDR)                                      
//SYSIN    DD *                                                        
 SORT FIELDS=COPY                                                      
 OUTFIL REMOVECC,NODETAIL,                                            
 HEADER1=('//JOB',JP1,                                                
          C'    JOB ''',C'TEST''',C',''',C'TEST''',C',',/,            
          '//',8X,C'CLASS=A,MSGCLASS=X,',/,                            
          '//',8X,C'MSGLEVEL=(1,1),NOTIFY=&SYSUID,',/,                
          '//',8X,C'REGION=0M',/,                                      
          '//*',/,                                                      
          '//PROCLIB  JCLLIB ORDER=',JP2,/,                            
          '//',11X,C' ',JP3,/,                                          
          '//*',/,                                                      
          '//SYMBOLIC INCLUDE MEMBER=',JP5,/,                          
          '//*',/,                                                      
          '//TESTPROC ',C'EXEC TESTPROC,',/,                            
          '//',12X,C'SEG=',JP1,C',',/,                                  
          '//*')                                                        
/*                                                                      
**************************** Bottom of Data ****************************
 


When the above piece is executed (with a valid job card), the output:


********************************* TOP OF DATA **********************************
//JOB0    JOB 'TEST','TEST',                                                    
//        CLASS=A,MSGCLASS=X,                                                  
//        MSGLEVEL=(1,1),NOTIFY=&SYSUID,                                        
//        REGION=0M                                                            
//*                                                                            
//PROCLIB  JCLLIB ORDER=(TEST.LIB1,                                            
//            TEST.LIB2),                                                      
//*                                                                            
//SYMBOLIC INCLUDE MEMBER=MYPDSMEM                                              
//*                                                                            
//TESTPROC EXEC TESTPROC,                                                      
//            SEG=0,                                                            
//*                                                                            
******************************** BOTTOM OF DATA ********************************
 


Surabhi wrote:...Can this be done using *SORT ? ...

Yes, it can be done using SORT (DF*/SYNC*) with OUTFIL sub-functions and SYMNAMES.
If you're not very comfortable on either (learn them, they are really useful), use REXX, it'd be much simpler as the code is more easily discernable and end-logic is completely user driven as against *SORT.

Surabhi wrote:... For ispf FILE-TAILORING i went through the example you provied, but could not get much. ...

Hope you referred the links shared by 'Superk' and 'Expat' as well. Think of it as learning a new programming language, some work will be required here- should you want to go that way; but the results are worth the time spent.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: JCL to build multiple jcl's using a template

Postby Surabhi » Tue Nov 08, 2016 5:15 pm

Hey thank you so much for this jcl. This is working perfectly for me.
But the issue what i have is, my input file is a PS file with list of memebers.
Here's an example:-
MY.WORK.PS.FILE---This has list of memebers
ABC1
ABC2
ABC3
ABC4
ABC5
So, how can i get 5 output jobs for 5 members?

Thanks.
Surabhi
 
Posts: 49
Joined: Thu Sep 10, 2015 7:51 pm
Has thanked: 4 times
Been thanked: 0 time

Re: JCL to build multiple jcl's using a template

Postby NicC » Tue Nov 08, 2016 6:52 pm

By browsing the forum where there are several examples of what you are doing.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: JCL to build multiple jcl's using a template

Postby Aki88 » Tue Nov 08, 2016 7:09 pm

Hello,

As Mr. Clouston has stated, the bare minimum expectation here was that YOU'd read the manuals, search the forums and build forward accordingly as the keywords and a working sample was provided for a DFSORT solution; share what you'd developed and in case of errors we could've guided you - instead of you looking for a final-working solution.

Here's a quick and dirty solution though, I'd leave it unto you to figure out what each command is doing by referring the manuals; note, you'll still be required to build your own JCL and symbolics:


//SORTJCL JOB 'SAMPLE','SYMNAMES',                                      
//        CLASS=A,MSGCLASS=X,                                          
//        MSGLEVEL=(1,1),                                              
//        NOTIFY=ME,REGION=0M                                          
//*                                                                    
// SET SEG='0',                                                        
//     LIBRARY1='(TEST.LIB1,',                                          
//     LIBRARY2='TEST.LIB2)',                                          
//     MEMLIB='MYPDSMEM'                                                
//*                                                                    
//STEP001  EXEC PGM=SORT,COND=(0,NE),                                  
//             PARM=('JP1"&SEG",JP2"&LIBRARY1",JP3"&LIBRARY2"',        
//             'JP4"&MEMLIB"')                                          
//SYSOUT   DD SYSOUT=*                                                  
//SYMNOUT  DD SYSOUT=*                                                  
//SYMNAMES DD DISP=SHR,DSN=MY.PDS(TEST)                                
//SORTIN   DD DISP=SHR,DSN=MY.PDS(MEMLIST)                              
//SORTOUT  DD SYSOUT=*                                                  
//SYSIN    DD *                                                        
 SORT FIELDS=COPY
 OUTFIL REMOVECC,                                                      
   BUILD=(JOB1,JP1,JOB1A,JOB1B,JOB1C,JOB1D,JOB1E,/,                    
          JOB2,8X,JOB2A,/,                                              
          JOB3,8X,JOB3A,/,                                              
          JOB4,8X,JOB4A,/,                                              
          JOB5,/,                                                      
          JOB6,JP2,/,                                                  
          JOB7,12X,JP3,/,                                              
          JOB8,/,                                                      
          JOB9,JP4,/,                                                  
          JOB10,/,                                                      
          JOB11,X,1,8,C',',/,                                                
          JOB12,12X,JOB12A,JP1,/,                                      
          JOB13,/,C'//')                                                
/*                                                                      
 


Contents of PDS member TEST:


JOB1,C'//JOB'                            
JOB1A,C'    JOB '''                      
JOB1B,C'TEST'''                          
JOB1C,C','''                              
JOB1D,C'TEST'''                          
JOB1E,C','                                
JOB2,C'//'                                
JOB2A,C'CLASS=A,MSGCLASS=X,'              
JOB3,C'//'                                
JOB3A,C'MSGLEVEL=(1,1),NOTIFY=&SYSUID,'  
JOB4,C'//'                                
JOB4A,C'REGION=0M'                        
JOB5,C'//*'                              
JOB6,C'//PROCLIB  JCLLIB ORDER='          
JOB7,C'//'                                
JOB7A,C' '                                
JOB8,C'//*'                              
JOB9,C'//SYMBOLIC INCLUDE MEMBER='        
JOB10,C'//*'              
JOB11,C'//TESTPROC EXEC'  
JOB12,C'//'                
JOB12A,C'SEG='            
JOB12B,C','                
JOB13,C'//*'              
 


Contents of PDS member MEMLIST:


ZINGY  
MONIKER
DANIEL  
PEDROSA
SOMETEST
 
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post