IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

GROUP - header data to be repeated in detail records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Musab Ahmed

New User


Joined: 10 Dec 2012
Posts: 37
Location: India

PostPosted: Mon Feb 01, 2016 11:36 am
Reply with quote

Hi,

I have a requirement to copy some text from header data to each record in the body of the group. for example, I have an input dataset as follows (FB, LRECL=6). '01' indicates beginning of a group in the 1st column. the next 01 indicates end of a group.

input:
Code:
01tkt1
02dddd
03dddd
01tkt2
02dddd
01tkt3
03dddd

I require an output as follows.

SEQ number to be appended to the end of the record(single digit) and tkt1 or tkt2 or tkt3 in header to be repeated in all of the detail records of the corresponding group.

Code:
01tkt11tkt1
02dddd2tkt1
03dddd3tkt1
01tkt21tkt2
02dddd2tkt2
01tkt31tkt3
03dddd2tkt3

Could anyone please help?
Back to top
View user's profile Send private message
boyti ko

New User


Joined: 03 Nov 2014
Posts: 78
Location: Malaysia

PostPosted: Mon Feb 01, 2016 11:45 am
Reply with quote

Check this example.
http://ibmmainframes.com/about63061.html
Back to top
View user's profile Send private message
Musab Ahmed

New User


Joined: 10 Dec 2012
Posts: 37
Location: India

PostPosted: Mon Feb 01, 2016 12:10 pm
Reply with quote

I have written a piece of code where i use the PUSH keyword and it works.

Code:
    SORT FIELDS=COPY                                 
    INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'01'),
                  PUSH=(7:SEQ=1,8:3,4))             
    OUTREC BUILD=(1:1,11)                           

output:

Code:
01tkt11tkt1
02dddd2tkt1
03dddd3tkt1
01tkt21tkt2
02dddd2tkt2
01tkt31tkt3
03dddd2tkt3
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Feb 01, 2016 12:35 pm
Reply with quote

You don't need the OUTREC BUILD at all. Otherwise, good to go.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top