View previous topic :: View next topic
|
Author |
Message |
navneetkadu
New User
Joined: 16 Nov 2006 Posts: 3 Location: Pune, India
|
|
|
|
In file I have two types of records:
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DTL02011324506001222HAN
DTL12011324506001222UUUUUUUU
DTL08011324506001222888981
DET01011324506000222YUNI
DET02011324506000222777777UU
DET0801132450600022200000000
DET120113245060002224528
DTL08011324507003222842916
DTL08011324507003222
DTL01011324507001222YUYRR
DTL08011324507001222
DTL1201132450700122200652
BAT0B V2221312161301132450702121212XYYYY
BAT0B V2221312161301132450602121212XYYYY |
------------------------------------------------------------------------
Input file has two types of records, detail and batch.
Where I want to sort Detail records on 12 digits (10 digits base and 2 digit sequence) number (start 6th position till 17th).
And then place the corresponding Batch record after the end of corresponding detail records. Batch record has 10 digit base in it, (starts at 29th position till 38th)
Out file I want as below:
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DET01011324506000222YUNI
DET02011324506000222777777UU
DET0801132450600022200000000
DET120113245060002224528
DTL02011324506001222HAN
DTL12011324506001222UUUUUUUU
DTL08011324506001222888981
BAT0B V2221312161301132450602121212XYYYY
DTL01011324507001222YUYRR
DTL08011324507001222
DTL1201132450700122200652
DTL08011324507003222842916
DTL08011324507003222
BAT0B V2221312161301132450702121212XYYYY |
------------------------------------------------------------------------
Please let me know if any one have some specific approach for this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Suggest you prepend the base & seq then a "type" (1 for dtl, 2 for bat), sort on these prepended values then leave them off when writing the output. |
|
Back to top |
|
|
navneetkadu
New User
Joined: 16 Nov 2006 Posts: 3 Location: Pune, India
|
|
|
|
Hey Dick, thank you for your response.
Can this be done for VB file? my file is VB. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Exactly wyh you "prepend" and not stick the seq at the other end. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Yes - i repeat what Nic said. |
|
Back to top |
|
|
navneetkadu
New User
Joined: 16 Nov 2006 Posts: 3 Location: Pune, India
|
|
|
|
It works.. I got my expected results.
Thank you! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
Back to top |
|
|
|