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

Write a current record plus previous record filed


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

New User


Joined: 30 Sep 2006
Posts: 5

PostPosted: Sat Jun 12, 2021 12:27 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Sat Jun 12, 2021 2:40 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Sat Jun 12, 2021 4:46 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Tue Jun 15, 2021 11:10 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Tue Jun 15, 2021 5:23 pm
Reply with quote

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
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top