Page 1 of 1

Trailer style output from icetool occur

PostPosted: Mon May 12, 2008 7:28 pm
by receive
I have a file about 2000 records, with either a "B", "M", "U", or blank space at position 69, and i'm trying to generate a trailer based on that.

It didn't take me very long to come up with:

OCCUR FROM(CACSIN) LIST(RPT) -                                                 
 HEADER('TYPE') ON(69,1,CH) -                                                 
 HEADER('NUMBER') ON(VALCNT,E'999999') -                                       
 BLANK 


which gives output of:
TYPE   NUMBER                                                                   
----   ------                                                                   
       000012                                                                   
B      000061                                                                   
M      000937                                                                   
U      000870


however, i'm looking to get all the data onto one line like:

XYZM000937U000870B000061


I've spent the last few hours going through my manuals and examples, and I haven't seen anything that helped as to how i should approach this, so any help would be appreciated.

Re: Trailer style output from icetool occur

PostPosted: Mon May 12, 2008 8:42 pm
by Frank Yaeger
It's not clear what you're trying to do. Do you just want the trailer records or do you want the data records and the trailer records? Where does 'XYZ' come from in the trailer. Why isn't '000012' in the trailer? Why is the order M, U, B in the trailer? And so on.

Please show an example of your input records (relevant fields only) and what you expect for output. Please explain the "rules" for getting from input to output using your example. Please explain the rules for constructing the trailer. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.

Re: Trailer style output from icetool occur

PostPosted: Tue May 13, 2008 2:06 pm
by receive
Frank Yaeger wrote:It's not clear what you're trying to do. Do you just want the trailer records or do you want the data records and the trailer records? Where does 'XYZ' come from in the trailer. Why isn't '000012' in the trailer? Why is the order M, U, B in the trailer? And so on.


To put my question in a bit more context, I've been asked to figure out how several jobs that run where I work currently could be achieved using icetool. In this case, i'm interested in trying to get my result into the one line trailer format that is currently produced. Ideally I'd like the data and the trailer in the same file at the end.

So, I want to be able to order M, B and U in the order they're currently ordered in and disgard the 000012. The XYZ is just static data, presumably used by whatever processes this trailer.

Frank Yaeger wrote: Please show an example of your input records (relevant fields only) and what you expect for output. Please explain the "rules" for getting from input to output using your example. Please explain the rules for constructing the trailer. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.


The rule for output is fairly simple: Three fixed characters, M, number of occurances of M in column 69, U, number of occurances of U in column 69, B, number of occurances of B in column 69. This column 69 on the input is a character field.

The RECFM is FB, and the LRECL is 6561

Re: Trailer style output from icetool occur

PostPosted: Tue May 13, 2008 9:30 pm
by Frank Yaeger
If I understand what you want (and I'm not sure I do), this DFSORT job will do it. SORTOUT will contain your trailer record with the counts.

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/6561)
//SORTOUT DD DSN=...  output file (FB/24)
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(69,1,CH,EQ,C' ')
  INREC IFTHEN=(WHEN=INIT,BUILD=(1:69,1,2:6C'0',8:6C'0',14:6C'0')),
    IFTHEN=(WHEN=(1,1,CH,EQ,C'M'),OVERLAY=(7:C'1')),
    IFTHEN=(WHEN=(1,1,CH,EQ,C'U'),OVERLAY=(13:C'1')),
    IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),OVERLAY=(19:C'1'))
  OUTFIL REMOVECC,NODETAIL,
    BUILD=(24X),
    TRAILER1=(C'XYZM',TOT=(2,6,ZD,EDIT=(TTTTTT)),
              C'U',TOT=(8,6,ZD,EDIT=(TTTTTT)),
              C'B',TOT=(14,6,ZD,EDIT=(TTTTTT)))
/*

Re: Trailer style output from icetool occur

PostPosted: Wed May 14, 2008 2:19 pm
by receive
Thanks Frank, that's exactly what i was looking for.

One more question, is there a way to output the original file together with this trailer record, without reading the input file twice?

Re: Trailer style output from icetool occur

PostPosted: Wed May 14, 2008 8:45 pm
by Frank Yaeger
is there a way to output the original file together with this trailer record, without reading the input file twice?


Yes, with a DFSORT job like this:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/6561)
//SORTOUT DD DSN=...  output file (FB/6561)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
      OVERLAY=(6562:6C'0',6568:6C'0',6574:6C'0')),
    IFTHEN=(WHEN=(69,1,CH,EQ,C'M'),OVERLAY=(6567:C'1')),
    IFTHEN=(WHEN=(69,1,CH,EQ,C'U'),OVERLAY=(6573:C'1')),
    IFTHEN=(WHEN=(69,1,CH,EQ,C'B'),OVERLAY=(6579:C'1'))
  OUTFIL REMOVECC,BUILD=(1,6561),
    TRAILER1=(C'XYZM',TOT=(6562,6,ZD,EDIT=(TTTTTT)),
              C'U',TOT=(6568,6,ZD,EDIT=(TTTTTT)),
              C'B',TOT=(6574,6,ZD,EDIT=(TTTTTT)))
/*

Re: Trailer style output from icetool occur

PostPosted: Wed May 14, 2008 9:01 pm
by receive
Frank,

That's worked perfectly. Thanks for your help :)