Merge the records based on Header



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

Merge the records based on Header

Postby nagarajan_v » Sun Aug 04, 2013 1:55 am

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
nagarajan_v
 
Posts: 7
Joined: Tue Jul 30, 2013 3:51 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Merge the records based on Header

 

Re: Merge the records based on Header

Postby NicC » Sun Aug 04, 2013 4:00 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Merge the records based on Header

Postby nagarajan_v » Tue Aug 06, 2013 12:35 am

Hi All,

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

Thanks,
Nag
nagarajan_v
 
Posts: 7
Joined: Tue Jul 30, 2013 3:51 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Merge the records based on Header

Postby NicC » Tue Aug 06, 2013 3:00 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Merge the records based on Header

Postby BillyBoyo » Tue Aug 06, 2013 3:47 am

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Merge the records based on Header

Postby BillyBoyo » Tue Aug 06, 2013 5:45 am

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'))
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post