Can I use DFSORT to submit n jcl's, changing parameters?

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
filikindri
Member
Posts: 20
Joined: Fri Feb 17, 2012 2:11 am

Can I use DFSORT to submit n jcl's, changing parameters?

Post by filikindri » Fri Feb 17, 2012 10:41 pm

I've got a sample jcl, somethig like myuser.mylibrary(smpljcl1)

Code: Select all

//job1      job class=a,msgclass=x
//step1     exec pgm=mypg,parms='xxxx,yyyy'
//filein     dd dsn=myfilezz,disp=shr
I've got another file ,FB, something like:

Code: Select all

01-aaaa-bbbb
02-cccc-dddd
03-eeee-ffff
...
nn-vvvv-wwww
I'd like to use as input these two files, and sortout to z-os internal reader, so i have nn jcl's submitted, replacing zz with nn , xxxx with aaaa and yyyy with bbbb, for each 2nd file record. Characters to be replaced could be parameters, dsn's, etc... I think this is not relevant for my question.

How could I do this?

Thanks a lot in advance

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Sat Feb 18, 2012 12:33 am

something like ... Characters to be replaced could be parameters, dsn's, etc...
This implies you want a general solution for various different situations (e.g. different number of JCL records, different fields to be replaced, different locations for the fields, etc). If so, then I would suggest writing a program with the logic to handle all of the possible variations.

On the other hand, if you're looking for a DFSORT solution for the exact situation described in your example, I could probably come up with one.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

filikindri
Member
Posts: 20
Joined: Fri Feb 17, 2012 2:11 am

Post by filikindri » Sat Feb 18, 2012 2:44 pm

I'm looking for a DFSORT solution. I'm not looking for a general solution. I want to solve a particular need. I will know exactly what I need to substitute.

My jcl would be quite simple,

Code: Select all

//job1      job class=a,msgclass=x 
//step1     exec pgm=mypg,parms='xxxx,yyyy' 
//filein     dd dsn=myfilezz,disp=shr
//fileout   dd dsn=another.file,DISP=MOD               
Suposse this, I added one line, just to have at least one with no replacement required.

I just want to submit n jobs like this. If you could help...

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sun Feb 19, 2012 6:32 pm

Mind you - if you had done it manually you could have done it by now. I know it is very tedious but sometimes that is the best way. Especially for one-off events.
Regards
Nic

filikindri
Member
Posts: 20
Joined: Fri Feb 17, 2012 2:11 am

Post by filikindri » Mon Feb 20, 2012 12:49 pm

I'm not looking for a general solution, but it is not an one time occurence event. The jcl sample will be always the same, but the task to submit n jcl's, will be running every 15 minutes.

To submit manually jcl's is not an option, I think.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Feb 21, 2012 1:23 am

Here's a DFSORT/ICETOOL job that will give you what you asked for (although I'm not convinced it's actually what you want). I'm assuming that every record in the INJCL file has a blank in position 72 and every record in the INPRMS file has a blank in position 13.

Code: Select all

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//INJCL DD DSN=...  input member with 4 JCL stmts (FB/80)
//INPRMS DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD ...  output file for internal reader
//TOOLIN DD *
RESIZE FROM(INJCL) TO(T1) TOLEN(320)
COPY JKFROM TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
  JOINKEYS F1=T1,FIELDS=(72,1,A),SORTED
  JOINKEYS F2=INPRMS,FIELDS=(13,1,A),SORTED
  REFORMAT FIELDS=(F1:1,320,F2:1,12)
  OPTION COPY
  INREC OVERLAY=(114:324,4,119:329,4,187:321,2)
  OUTFIL FNAMES=OUT,
    BUILD=(1,80,/,81,80,/,161,80,/,241,80)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

filikindri
Member
Posts: 20
Joined: Fri Feb 17, 2012 2:11 am

Post by filikindri » Tue Feb 21, 2012 1:20 pm

Many many thanks.

I'll try it.

Best regards.

filikindri
Member
Posts: 20
Joined: Fri Feb 17, 2012 2:11 am

Post by filikindri » Tue Feb 21, 2012 3:09 pm

Yes, works as expected

Code: Select all

10.58.38 JOB02748  IEF403I JSUBTAF - STARTED - TIME=10.58.38                    
10.58.38 JOB02749  $HASP100 JOB1     ON INTRDR                            FROM J
10.58.38 JOB02749  IRR010I  USERID myuser  IS ASSIGNED TO THIS JOB.            
10.58.38 JOB02750  $HASP100 JOB1     ON INTRDR                            FROM J
10.58.38 JOB02750  IRR010I  USERID myuser IS ASSIGNED TO THIS JOB.            
10.58.38 JOB02751  $HASP100 JOB1     ON INTRDR                            FROM J
10.58.38 JOB02751  IRR010I  USERID myuser IS ASSIGNED TO THIS JOB.            
10.58.38 JOB02752  $HASP100 JOB1     ON INTRDR                            FROM J
10.58.38 JOB02752  IRR010I  USERID myuser IS ASSIGNED TO THIS JOB.            
10.58.38 JOB02753  $HASP100 JOB1     ON INTRDR                            FROM J
10.58.38 JOB02753  IRR010I  USERID myuser IS ASSIGNED TO THIS JOB.            
10.58.39 JOB02748  GSDMV20I -JOBNAME  STEPNAME PROCSTEP CCODE ELAPSED-TIME  CPU-
10.58.39 JOB02748  GSDMV21I -JSUBTAF           S1           0     00:00:00     0
10.58.39 JOB02748  IEF404I JSUBTAF - ENDED - TIME=10.58.39                      
Now I'm going to modify to use my real sample jcl (it is a bit longer).

Some way to avoid last sentence, when working with a 20 lines sample jcl? BUILD=(1,80,/,81,80,/,161,80,/...,145,80) . Just curious, I can live with it; not a real problem.

Thanks again.

filikindri
Member
Posts: 20
Joined: Fri Feb 17, 2012 2:11 am

Post by filikindri » Tue Feb 21, 2012 4:32 pm

Now it is working with my sample, final (at this moment) code is:

Code: Select all

//TOOLIN DD *                                 
RESIZE FROM(INJCL) TO(T1) TOLEN(4480)         
COPY JKFROM TO(OUT) USING(CTL1)               
/*                                            
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
//CTL1CNTL DD *                               
  JOINKEYS F1=T1,FIELDS=(72,1,A),SORTED       
  JOINKEYS F2=INPRMS,FIELDS=(15,1,A),SORTED   
   REFORMAT FIELDS=(F1:1,4480,F2:1,14)        
    OPTION COPY                               
    INREC OVERLAY=(447:4481,2,                
                   672:4483,6,                
                   679:4489,6,                
                   2451:4483,6,               
                   2457:4489,6,               
                   2737:4481,2)               
                                                              
OUTFIL FNAMES=OUT,                                            
  BUILD=(1,80,/,81,80,/,161,80,/,241,80,/,321,80,/,401,80,/,  
  481,80,/,561,80,/,641,80,/,                                 
  721,80,/,801,80,/,881,80,/,961,80,/,                        
  1041,80,/,1121,80,/,1201,80,/,1281,80,/,1361,80,/,1441,80,/,
  1521,80,/,1601,80,/,1681,80,/,1761,80,/,1841,80,/,1921,80,/,
  2001,80,/,2081,80,/,2161,80,/,2241,80,/,2321,80,/,2401,80,/,
  2481,80,/,2561,80,/,2641,80,/,2721,80,/,2801,80,/,2881,80,/,
  2961,80,/,3041,80,/,3121,80,/,3201,80,/,3281,80,/,3361,80,/,
  3441,80,/,3521,80,/,3601,80,/,3681,80,/,3761,80,/,3841,80,/,
  3921,80,/,4001,80,/,4081,80,/,4161,80,/,4241,80,/,4321,80,/,
  4401,80)   
My jcl sample is 56 lines long. :oops:
My file with variable fields is format NNAAAAAABBBBBB.
And some parameters must be replaced at two places in the sample.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Feb 21, 2012 11:59 pm

I'm impressed that you were able to extrapolate my simple example to a more complex example. Nice work.

If you don't mind using an extra pass and an extra temp data set, you can avoid the BUILD with / statement by doing another RESIZE. Here's the change for my original 4 card example - if you like it, you could change your more complex example in a similar way (remember to have the CTL2CNTL INREC remove the last 80 bytes).

Code: Select all

//S1    EXEC  PGM=ICETOOL                                            
//TOOLMSG DD SYSOUT=*                                                
//DFSMSG  DD SYSOUT=* 
//INJCL DD DSN=...  input member with 4 JCL stmts (FB/80) 
//INPRMS DD DSN=...  input file2 (FB/80) 
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)           
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)           
//OUT DD ...  output file for internal reader 
//TOOLIN DD *                                                        
RESIZE FROM(INJCL) TO(T1) TOLEN(320)                                 
COPY JKFROM TO(T2) USING(CTL1)                                       
RESIZE FROM(T2) TO(OUT) TOLEN(80) USING(CTL2)     
/*                   
//CTL1CNTL DD *                                                      
  JOINKEYS F1=T1,FIELDS=(72,1,A),SORTED                              
  JOINKEYS F2=INPRMS,FIELDS=(13,1,A),SORTED                          
  REFORMAT FIELDS=(F1:1,320,F2:1,12)                                 
  OPTION COPY                                                        
  INREC OVERLAY=(114:324,4,119:329,4,187:321,2)                      
/*
//CTL2CNTL DD *                                                      
  INREC BUILD=(1,320)                                                
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

filikindri
Member
Posts: 20
Joined: Fri Feb 17, 2012 2:11 am

Post by filikindri » Wed Feb 22, 2012 12:54 pm

Yes, It 's long better than v1.

I can't understand 'remove last 80 bytes'. Perhaps you mean 'remove last 12 bytes'. right?

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Feb 22, 2012 10:58 pm

Yes, you're right. I forgot that I only used 12 bytes from F2, not 80. I should have said "remove the F2 bytes".
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others