Page 1 of 1

Merge the records based on Header

PostPosted: Sun Aug 04, 2013 1:55 am
by nagarajan_v
Can we do below with DFSORT?..
Both Input and output file is 80 bytes length.. TITLE 1,TITLE 2 and HEADER will be same for all group.


Input file:
TITLE 1
TITLE 2
HEADER
Karthik
REC1
REC2
Mohan
REC1
REC2
TITLE 1
TITLE 2
HEADER
Karthik
REC3
REC4
Mohan
REC3
REC4
REC5

Output file:
TITLE 1
TITLE 2
HEADER
Karthik
REC1
REC2
REC3
REC4
TITLE 1
TITLE 2
HEADER
Mohan
REC1
REC2
REC3
REC4
REC5

Thanks,
Nagarajan

Re: Merge the records based on Header

PostPosted: Sun Aug 04, 2013 4:00 pm
by NicC
Nagarajan

Do not add new topics to previous topics. Do not address queries to specific people and AS MENTIONED BEFORE use the code tags! I was sorely tempted to just delete the post rathe than split it out.

Re: Merge the records based on Header

PostPosted: Tue Aug 06, 2013 12:35 am
by nagarajan_v
Hi All,

Any body can help on the above requirement?. I need it very urgent....

Thanks,
Nag

Re: Merge the records based on Header

PostPosted: Tue Aug 06, 2013 3:00 am
by NicC
Do not solicit for replies. People answer as and when they feel like it - or not. Also, this is a weekend - why should people not enjoy their time off.
Next, if it is urgent then do not use a forum because, as I have just stated, people respond if and when they feel like.

Re: Merge the records based on Header

PostPosted: Tue Aug 06, 2013 3:47 am
by BillyBoyo
You really must not rely on people here doing your work.

If your sample input is good, OMIT COND=( for the TITLE 1, TITLE 2 and HEADER, use a similar technique to what Kolusu has already showed you, and then look at OUTFIL with REMOVECC, SECTIONS and HEADER3 to re-generate the TITLE 1, TITLE 2 and HEADER.

Re: Merge the records based on Header

PostPosted: Tue Aug 06, 2013 5:45 am
by BillyBoyo
Here's the extra code.

This, to get rid of your originals:

  OMIT COND=(1,7,SS,EQ,C'TITLE 1,TITLE 2,HEADER ')


You'll need to change your WHEN=GROUP to have something like this instead:

BEGIN=(1,3,CH,NE,C'REC')


And this to get your original "headings" back:

  OUTFIL BUILD=(1,80),REMOVECC,SECTIONS=(81,10,
                    HEADER3=('TITLE 1',/,
                             'TITLE 2',/,
                             'HEADER'))