Page 1 of 1

JCL Split IF more than 200 Steps

PostPosted: Mon Mar 10, 2014 1:45 pm
by Ramsee
Hi All,

Warm greeting!!

I have a requirement that need to split a JCL File that contains more than 500 steps in it, I need to split JCL file for every 200 steps and write into an another file.

sample jcl:
details:
1.STEP Numbers are sequential and every step ends with a delimiter "/*"
2.INPUT JCL FILE FORMAT = FB , RECORD LENGTH = 80
//PS0001   EXEC PGM=PKZIP,             
//SYSPRINT DD SYSOUT=U                   
//SYSOUT   DD SYSOUT=U                   
//SYSUDUMP DD SYSOUT=V                   
//INPUT      DD DSN=USER.V0002,DISP=SHR
//OUTPUT   DD DSN=USER.V0002066.ZIP,
//            DISP=(,CATLG,DELETE),       
//            SPACE=(CYL,(1,1),RLSE),     
//            DCB=(RECFM=U,BLKSIZE=27998)
//SYSIN    DD *                           
-ECHO                                     
-INDD(INPUT)                             
-ARCHOUTDD(OUTPUT)                       
-TEXT                                     
-PASSWORD(TEST)                       
-NIA(USER.V0002,V0002066.TXT)     
/*                                       
.
.
.
.
.
.
//PS0517   EXEC PGM=PKZIP,             
//SYSPRINT DD SYSOUT=U                   
//SYSOUT   DD SYSOUT=U                   
//SYSUDUMP DD SYSOUT=V                   
//INPUT    DD DSN=USER.V1999,DISP=SHR   
//OUTPUT   DD DSN=USER.V1999066.ZIP,     
//            DISP=(,CATLG,DELETE),     
//            SPACE=(CYL,(1,1),RLSE),   
//            DCB=(RECFM=U,BLKSIZE=27998)
//SYSIN    DD *                         
-ECHO                                   
-INDD(INPUT)                             
-ARCHOUTDD(OUTPUT)                       
-TEXT                                   
-PASSWORD(TEST)                       
-NIA(USER.V1999,V1999066.TXT)           
/*                                       

Kindly suggest me how to split this FILE for every 200 steps and write into a new file.

Regards,
Ramsee

Re: JCL Split IF more than 200 Steps

PostPosted: Mon Mar 10, 2014 2:11 pm
by enrico-sorichetti
the jcl is (1) handwritten once for all or is (2)generated automatically

in both cases the fastest way is to change the process that generates the jcl

Re: JCL Split IF more than 200 Steps

PostPosted: Mon Mar 10, 2014 2:19 pm
by Ramsee
Its an automatically generated steps by a COBOL pgm

Re: JCL Split IF more than 200 Steps

PostPosted: Mon Mar 10, 2014 2:25 pm
by enrico-sorichetti
then there is no reason not to change the cobol program to do the split itself

exec pgm=<the program>,parm=

where if parm omitted or set to 0 a single file is generated ( no split )
otherwise split every PARM provided steps

and please ...
do not complain about having to allocate the MAX number of files that could result for the split...
You will have to do that even if You were able to use sort

a simpler way from a file allocation point of view could be to store the segments as members of a PDS

Re: JCL Split IF more than 200 Steps

PostPosted: Tue Mar 11, 2014 2:42 am
by skolusu
As Enrico mentioned you should be splitting the file in the cobol program itself. But if you do insist doing it separately then use the following JCL

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DISP=SHR,DSN=Your Input file to split
//OUT01    DD SYSOUT=*                                       
//OUT02    DD SYSOUT=*                                       
//OUT03    DD SYSOUT=*                                       
//OUT04    DD SYSOUT=*                                       
//OUT05    DD SYSOUT=*                                       
//SYSIN    DD *                                             
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(12,9,CH,EQ,C'EXEC PGM='), 
  PUSH=(81:ID=4))                                           
                                                             
  OUTFIL FNAMES=OUT01,BUILD=(1,80),                         
  INCLUDE=(81,4,ZD,GT,0000,AND,81,4,ZD,LE,0200)             
                                                             
  OUTFIL FNAMES=OUT02,BUILD=(1,80),                         
  INCLUDE=(81,4,ZD,GT,0200,AND,81,4,ZD,LE,0400)             
                                                             
  OUTFIL FNAMES=OUT03,BUILD=(1,80),                         
  INCLUDE=(81,4,ZD,GT,0400,AND,81,4,ZD,LE,0600)             
                                                             
  OUTFIL FNAMES=OUT04,BUILD=(1,80),                         
  INCLUDE=(81,4,ZD,GT,0600,AND,81,4,ZD,LE,0800)             
                                                             
  OUTFIL FNAMES=OUT05,BUILD=(1,80),                         
  INCLUDE=(81,4,ZD,GT,0800,AND,81,4,ZD,LE,1000)             
/*

Re: JCL Split IF more than 200 Steps

PostPosted: Tue Mar 11, 2014 8:56 pm
by Ed Goodman
Would it make more sense to change the input parms to PKZIP so that it does each person separately?