Page 1 of 1

formatting records in JCL

PostPosted: Tue Apr 27, 2010 7:35 pm
by dohara
Hi

Is there a possibility to format records in JCL (instead of REXX)

In the input file (it's a flat file) i have the following records:
AD1112
BD1111
CD2121
DD1222

I want them to be written to the output dataset in the following format:
AD1112,BD1111,CD2121,DD1222

comas are not necessarily needed.
Is there a utility to do it via JCL ? I could easily do it in REXX but currently it is not an option.
DFSORT - as i see - is not happy with doing the above.


Please let me know about your opinion
thanks
David

Re: formatting records in JCL

PostPosted: Tue Apr 27, 2010 10:12 pm
by Frank Yaeger
DFSORT - as i see - is not happy with doing the above.


You'd have to do a better job of explaining the "rules" for what you're trying to do before I could tell if that statement is correct or not.

Do you always just have 5 input records each with 6 byte values from which you want to create one output record? Or are there other variations? If there are other variations, you need to describe the complete requirement. Also, give the RECFM and LRECL of the input and output files and the starting position, length and format of the input fields.

Re: formatting records in JCL

PostPosted: Thu Apr 29, 2010 2:48 am
by dohara
Hi Frank

Thanks for your reply.

Both the input and output files use RECFM FB and LRECL 80
The input file contains 3 records, whose lenght can be different, from 1 byte to 5.
These records are always whole numbers from 0 to 99999.
The starting position of each record is the first byte.

an example of how the input records look like:

111
22222
33


The output record should look like:
YY.MM.DD,111,22222,33



Please let me know if you need further info
Thanks,
David

Re: formatting records in JCL

PostPosted: Thu Apr 29, 2010 4:35 am
by Frank Yaeger
Assuming that YY.MM.DD is the current year, month, day, you can use a DFSORT/ICETOOL job like the following to do what you asked for:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/80)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
  SPLICE FROM(IN) TO(OUT) ON(80,1,CH) WITHEACH -
    WITH(16,5) WITH(22,5) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,1,ZD)),
    IFTHEN=(WHEN=(81,1,ZD,EQ,1),BUILD=(DATE=(YMD.),10:1,5)),
    IFTHEN=(WHEN=(81,1,ZD,EQ,2),BUILD=(16:1,5)),
    IFTHEN=(WHEN=(81,1,ZD,EQ,3),BUILD=(22:1,5))
  OUTFIL FNAMES=OUT,BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=C','))
/*


Running your example today, I get the following for OUT:

10.04.28,111,22222,33       

Re: formatting records in JCL

PostPosted: Fri Apr 30, 2010 1:00 pm
by dohara
Hi Frank

thanks for your reply.
Your code is working fine. Will take a while to read it up in the manual and understand it all.
DFSORT getting started and the programmes guides will be useful.

I have one more question. I have plenty of jobs stored in a pds. Time to time i have to change certain things - like dataset suffix - in each.
Currently i do it via an ISPF macro but thinking if it can be done via DFSORT.
I can change the strings vai DFSORT but not sure how to get DFSORT to go thrugh each member.

Is there an easy way to do that? Or i should specify each member as input to DFSORT

Thanks,
David

Re: formatting records in JCL

PostPosted: Fri Apr 30, 2010 10:16 pm
by Frank Yaeger
Is there an easy way to do that? Or i should specify each member as input to DFSORT


You would have to specify each member - DFSORT cannot process the members of a PDS automatically.

Re: formatting records in JCL

PostPosted: Tue Oct 26, 2010 4:34 am
by Frank Yaeger
With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can use the new RESIZE function of DFSORT's ICETOOL to create the output record more easily like this:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=... input file (FB/80)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
RESIZE FROM(IN) TO(OUT) TOLEN(18) USING(CTL1)
//CTL1CNTL DD *
  INREC BUILD=(1,6)
  OUTFIL FNAMES=OUT,
    BUILD=(DATE=(YMD.),C',',1,18,SQZ=(SHIFT=LEFT,MID=C','),80:X)
/*


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss? ... g3T7000242