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

Sort header records keeping the details constant


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Jun 20, 2012 6:10 pm
Reply with quote

Hi,

I have the requirement as below.

REC FM - FB, LRECL = 80

the input records will be like this. Header is located as '04500' starting (2,5) for all these records the key is located at (42,11). The corresponding detail records will have '04510' in second position

Here for first header the key is 06001014683.

Code:


|04500|00001|2012-06-18 21:09:43|A|00312|06001014683|2012-06-18|00415|0
|04510|00001|2012-06-18 21:09:43|A|00411|000000001043464342|00000000104
|04510|00001|2012-06-18 21:09:43|A|00411|000000001043464412|00000000104
|04510|00001|2012-06-18 21:09:43|A|00411|000000001043462145|00000000104
|04500|00001|2012-06-18 21:09:44|A|00312|06001014674|2012-06-18|00201|0
|04510|00001|2012-06-18 21:09:44|A|00411|000000001043464275|00000000104
|04510|00001|2012-06-18 21:09:44|A|00411|000000001043464279|00000000104
|04510|00001|2012-06-18 21:09:44|A|00411|000000001043462092|00000000104
and so on...


I need to sort the headers on its key (42,11) and the corresponding detail records should not be changed in either order and the link between the original header its detail records should be the same.

Can someone please try to help on this?

Regards
Amar
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed Jun 20, 2012 6:19 pm
Reply with quote

Hello Amar,

What did you try and where did you fail (if you tried)?

Hint #1: Search the forum. This is recently discussed and who knows you might get a custom-made solution.
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Jun 20, 2012 6:27 pm
Reply with quote

Hi,

I got this by the below try after reading thru the manual. Thank you.

INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,5,CH,EQ,C'04500'),
PUSH=(80:42,11))
SORT FIELDS=(80,11,CH,A),EQUALS
OUTFIL BUILD=(1,80)

Regards
Amar
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed Jun 20, 2012 6:36 pm
Reply with quote

Thats a good try... Thanks for letting us know.

FYI, you have LRECL=80, so PUSH the key to position '81'.

I hope that helps.
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Jun 20, 2012 7:05 pm
Reply with quote

Hi,

Thank you. I actually had it 81 in my code. Here I posted it wrong.

But thanks for the correction.

Regards
Amar
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 20, 2012 9:38 pm
Reply with quote

V S Amarendra Reddy,

"Sort groups of records" is one of the many Smart DFSORT tricks shown here

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
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 Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top