Page 1 of 1

reformatting the input record using dfsort

PostPosted: Thu Jul 01, 2010 8:12 pm
by dgrimsley
I want to reformat the input record and combine part of a matching record and write out one record. The records are indentical other than position 13 for a length of 17.

My input is FB 87 bytes long

F10 002010SVBLDRBRKR NN6120
F10 002010WRBLDREXKR NN6120

F10 002010SVBLDRBRKR NN6130
F10 002010WRBLDREXKR NN6130

I need to combine the two records into one by removing the SV and the WR from position 13 and moving the BLDREXKR which is in position 15 for a length of 15 next to the BLDRBRKR (also in 15 for a length of 15 which will move over to position 13 for a length of 15).

Making the output look like this:

F10 002010BLDRBRKR BLDREXKR NN6120

F10 002010BLDRBRKR BLDREXKR NN6130

Re: reformatting the input record using dfsort

PostPosted: Thu Jul 01, 2010 9:20 pm
by skolusu
dgrimsley,

Based on the following assumptions

1. You will always have 2 records for every transaction to be merged.
2. It doesn't matter where the rest of the values are taken from( either record 1 or 2 )other than the fields you explained.
3. Since you are appending an extra 15 bytes on to the existing record and the record length being still the same , the last 15 bytes are truncated.

Use the following DFSORT JCL to get the desired results

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=Your input Fb 87 byte file,DISP=SHR             
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(88:SEQ=1,15,15)),       
  IFTHEN=(WHEN=(88,1,ZD,EQ,2),BUILD=(1,12,89,15,15,15,30,45))     
  OUTFIL INCLUDE=(88,1,CH,EQ,C' '),BUILD=(1,87)                   
//*