View previous topic :: View next topic
|
Author |
Message |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
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 |
|
|
Naish
New User
Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
|
|
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 |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
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 |
|
|
Naish
New User
Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
|
|
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 |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
Back to top |
|
|
|