View previous topic :: View next topic
|
Author |
Message |
Musab Ahmed
New User
Joined: 10 Dec 2012 Posts: 37 Location: India
|
|
|
|
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 |
|
|
boyti ko
New User
Joined: 03 Nov 2014 Posts: 78 Location: Malaysia
|
|
Back to top |
|
|
Musab Ahmed
New User
Joined: 10 Dec 2012 Posts: 37 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You don't need the OUTREC BUILD at all. Otherwise, good to go. |
|
Back to top |
|
|
|