Page 1 of 1

SORT reformat

PostPosted: Wed Nov 16, 2011 3:45 am
by bobpradeep
Hello

I have a input file with the following format

   1234----1012         141516.......24 ...............51.................188
   <account number1><date...........>                    1
   <account number1><date...........>                    3 
   <account number1><date...........>                    3
   <account number1><date...........>                    3
   <account number1><date...........>                    2
   <account number2><date...........>                    1
   <account number2><date...........>                    3
   <account number2><date...........>                    2
   <account number3><date...........>                    1
   <account number3><date...........>                    2

a report records arranged based on the record type on column 51.
I need to generate the file with the following format

   1234----1012         141516.......24 ...............51.................188
   <account number1><date...........>                    1
   <account number1><date...........>                    2 
   <account number1><date...........>                    3
   <account number1><date...........>                    3
   <account number1><date...........>                    3
   <account number2><date...........>                    1
   <account number2><date...........>                    2
   <account number2><date...........>                    3
   <account number3><date...........>                    1
   <account number3><date...........>                    2

Records are needed to be sorted based on the column 51.

Please note, records type 3 is optional and record type 1 and 2 records are mandatory in the input file.

Thanks
BOB

Re: SORT reformat

PostPosted: Wed Nov 16, 2011 4:04 am
by dick scherrer
Hello and welcome to the forum,

When posting data, code, JCL, etc using the Code tag will preserve alignment and improve readability.

Your data has been "Code"d, but i messed up with the alignment - suggest you practice a bit (there is a Preview function so you can see your post as it will appear to the forum, rather than how it looks in the Reply Panel).

I'm not sure i understand what else is neede, but can this simply be sorted on col 51 primary and then the account number?

Re: SORT reformat

PostPosted: Wed Nov 16, 2011 4:18 am
by Frank Yaeger
Bob,

It's not clear what you want. It looks like you want to sort by the account number and then by column 51, but I can't be sure. These DFSORT statements would give the expeced output you show, assuming that the account number is in positions 1-17:

  OPTION EQUALS                             
  SORT FIELDS=(1,17,CH,A,51,1,CH,A)         


If that's not what you want, then you need to do a better job of explaining what exactly it is that you do want. Show a better example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file.