reformatting the input record using dfsort



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

reformatting the input record using dfsort

Postby dgrimsley » Thu Jul 01, 2010 8:12 pm

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
dgrimsley
 
Posts: 7
Joined: Fri Jun 25, 2010 1:10 am
Has thanked: 0 time
Been thanked: 0 time

Re: reformatting the input record using dfsort

Postby skolusu » Thu Jul 01, 2010 9:20 pm

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)                   
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post