Page 1 of 1

Merge 2 records into single, involves reformating too

PostPosted: Thu Oct 09, 2014 7:18 pm
by hariharan_bk
Hi Team,

I need to merge 2 records into one single record. Could you please help

INPUT: (VB/120)
First record:
There are 59 bytes which remain as spaces from position 50. And we will have date at the end.
second record:
This record will have data (non spaces ex:HH) for those 59 bytes.

********************************* Top of Data **********************************
DTL,XXXXXXXX.XXXXXXXX.CXXXX.ITEXXXX.INPXX  ,                    20141004,   
                                                 HHHHHHHHHHHHHH,
******************************** Bottom of Data ********************************


Output expected: (VB/120)
These 2 input records are to be merged to get the complete merged single record
********************************* Top of Data **********************************
DTL,XXXXXXXX.XXXXXXXX.CXXXX.ITEXXXX.INPXX  ,  HHHHHHHHHHHHHH, 20141004,   
******************************** Bottom of Data ********************************


Code I tried which dint work yet:
 SORT FIELDS=COPY                                               
 INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(121:SEQ=1,50,59)),     
 IFTHEN=(WHEN=(121,1,ZD,EQ,2),BUILD=(1,4,5,45,50:122,59,109,12))
 OUTFIL BUILD=(1,120)                                           


Program used:
//STEP111 EXEC PGM=SORT

The job ran fine but output is not as expected. Could someone pls check and advise us back.

Re: Merge 2 records into single, involves reformating too

PostPosted: Sun Oct 12, 2014 12:56 am
by hariharan_bk
Hi All,

Could someone pls help here on the above request. Thanks !!

Re: Merge 2 records into single, involves reformating too

PostPosted: Sun Oct 12, 2014 3:53 am
by NicC
Why should they? You know you have syncsort. You know there is another section of the forum for syncsort queries but you ignore that and post in a rival company's section. I could, of course, simply delete the topic but I will move it for you.

Re: Merge 2 records into single, involves reformating too

PostPosted: Sun Oct 12, 2014 6:15 am
by BillyBoyo
For variable-length records, it is usual to extend for temporary fields at the beginning of the record. That's just to emphasise "usually", at it doesn't matter here.

The first record has A blank C, the second blank B blank. If you PUSH A into the location it came from, similar with C, then when you look at the second record it will have A B C. Remove the second IFTHEN, put INCLUDE= for 2 on the OUTFIL, and you should be about there.