View previous topic :: View next topic
|
Author |
Message |
Vallabhaneni
New User
Joined: 30 Sep 2006 Posts: 5
|
|
|
|
Requirement
Every record starts with record type A1, if it hits another 'A1' means the group is completed, then I need to write output from the group appending the data field value from 'A1' record to all other records, and i should not write A1 record type.
Last group will not hit anothoer 'A1'
I searched on the forum, and tried to use If then group and push, no success.
I have a file with record length 100
Input = 100
Output = 108 ( Input + data lengh 8( from A1 Record data)
Layout
Code: |
Key - Type - data
AAAA A1 12345678
AAAA A2 acvdevgh
AAAA X1 hello
BBBB A1 67891012
BBBB B1 jhjlhjlhj
BBBB X1 Hello1
CCCC A1 67891012
CCCC A3 jh3 nphp
CCCC A4 88989
CCCC X4 hello2 |
Out put input 100 + 8 ( data from A1 record , append from 101 to 8)
Code: |
AAAA A2 acvdevgh 12345678
AAAA X1 hello 12345678
BBBB B1 jhjlhjlhj 67891012
BBBB X1 Hello1 67891012
CCCC A3 jh3 nphp 67891012
CCCC A4 88989 67891012
CCCC X4 hello2 67891012 |
I appreciate your help.
Thanks in Advance.[/code] |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
You basically wants to push header A1 values to detail records and on the way out exclude A1 header
You have not done proper research .
ibmmainframes.com/about64751.html
Just use omit in the BUILD to above solution to get rid off A1 records and you are good. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1231 Location: Bamberg, Germany
|
|
|
|
Vallabhaneni wrote: |
Requirement
I searched on the forum, and tried to use If then group and push, no success. |
Post error msgs and the code you have tried. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1231 Location: Bamberg, Germany
|
|
|
|
Code: |
//WHATEVER EXEC PGM=ICEMAN
//SORTIN DD *
AAAA A1 12345678
AAAA A2 acvdevgh
AAAA X1 hello
BBBB A1 67891012
BBBB B1 jhjlhjlhj
BBBB X1 Hello1
CCCC A1 67891012
CCCC A3 jh3 nphp
CCCC A4 88989
CCCC X4 hello2
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(7,2,CH,EQ,C'A1'),PUSH=(28:14,10))
OUTFIL OMIT=(7,2,CH,EQ,C'A1')
END
/* |
Output:
Code: |
****** **************************** Datenanfang **
000001 AAAA A2 acvdevgh 12345678
000002 AAAA X1 hello 12345678
000003 BBBB B1 jhjlhjlhj 67891012
000004 BBBB X1 Hello1 67891012
000005 CCCC A3 jh3 nphp 67891012
000006 CCCC A4 88989 67891012
000007 CCCC X4 hello2 67891012
****** **************************** Datenende **** |
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2012 Location: USA
|
|
|
|
Just simple presenting to the lazy newbies any ready-to-use solution will have as the result them not to learn anything at all, and for all their following assignments they would again not stir a finger, but just ask the forum: "Please help me to do my own job?"
In the most cases there is even no "Thank you" from their side. |
|
Back to top |
|
|
|