Page 2 of 2

Re: Merge Header file and detail file

PostPosted: Thu Dec 26, 2013 4:29 pm
by avinashmusic
Hi Billy,

Can you just explain the OUTLEN code phrase for me? that would do, rest i get it myself

Re: Merge Header file and detail file

PostPosted: Thu Dec 26, 2013 4:44 pm
by BillyBoyo
Yes.

It is not OUTLEN, it is IFOUTLEN. It is not an IF of any type.

SORT will try to keep try of output lenghts in IFTHENs that have been adjusted by BUILD/OVERLAY. However, sometimes you need to tell SORT the output length from IFTHENs. And sometimes, our case, it is just the easiest way to adjust the record-length, where we want to cut the output record down from 161 bytes (on the REFORMAT record) to, in our case, 80 bytes for output.

If you read IFOUTLEN=80 as "set-the-record-length-for-the-ouptut-to-80" then you've got it.

And remember to explain the rest to us once you understand it. It is a way to learn. Better is to attempt it yourself first, which you will do next time..

Re: Merge Header file and detail file

PostPosted: Thu Dec 26, 2013 10:04 pm
by skolusu
Another way of getting the desired results is to simply concatenate both files to sortin as they have same DCB properties and validate the indicator


//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DISP=SHR,DSN=Your Input FB 200 Byte file1
//         DD DISP=SHR,DSN=Your Input FB 200 Byte file2
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(201:8,4)),
        IFTHEN=(WHEN=NONE,OVERLAY=(201:2,4))           
 
  SORT FIELDS=(201,4,CH,A,1,1,CH,D),EQUALS               
  OUTREC BUILD=(1,200)                                   
//*