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

Need help in adding Header to records


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
senthamizh

New User


Joined: 27 Apr 2009
Posts: 23
Location: mumbai

PostPosted: Thu Mar 07, 2019 7:55 pm
Reply with quote

Hi,

I have a input file in below format

Code:
DTL001111111 1234567890123-0000001R01/10/20181234567890xxxxx 123
DTL001111111 2345678901234-0000003R01/10/20181234567890xxxxx 123
DTL001111111 3456789012345-0000004R01/10/20181234567890xxxxx 123
DTL002222222 1234567890123-0000001R01/10/20181234567890xxxxx 124
DTL002222222 2345678901234-0000003R01/10/20181234567890xxxxx 124
DTL002222222 3456789012345-0000004R01/10/20181234567890xxxxx 123


the records should be grouped based on position 61,3 (123 or 124) and position 1,12(DTL0011111111 or DTL00222222222) then Header should be added to group.Header formate is as below

HDR1230011111111 P111111 000 1
the output should be as below

Code:
HDR123001111111 P111111                          000 1
DTL001111111 1234567890123-0000001R01/10/20181234567890xxxxx 123
DTL001111111 2345678901234-0000003R01/10/20181234567890xxxxx 123
DTL001111111 3456789012345-0000004R01/10/20181234567890xxxxx 123
HDR123002222222 P111111                          000 1
DTL002222222 3456789012345-0000004R01/10/20181234567890xxxxx 123
HDR124002222222 P111111                          000 1
DTL002222222 1234567890123-0000001R01/10/20181234567890xxxxx 124
DTL002222222 2345678901234-0000003R01/10/20181234567890xxxxx 124
TRL


Input record length is 65
output record length is 65.

Please lets me know if it can be done by SORT?

If it can be done in sort pls give idea to write sort condition for this requirement.

Thanks,
Sen
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Thu Mar 07, 2019 8:16 pm
Reply with quote

One way is below way and for more alternatives please Google it or search over here and let us know what you try or face any issues.
ibmmainframes.com/about24473.html
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 -> SYNCSORT

 


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 Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Adding first / last acct numerber to ... DFSORT/ICETOOL 7
Search our Forums:

Back to Top