View previous topic :: View next topic
|
Author |
Message |
krish.deepu
New User
Joined: 27 May 2014 Posts: 4 Location: India
|
|
|
|
Hello,
I've below requirement which I'm checking if it can be done via SORT.
There is a VB file/LRECL=504 which has around 8K records. It has a header and a trailer. The detailed records are grouped based on a 13 char long registration number. Under each registration number there can be multiple records which belongs to it. But the reg numbers will be always present in the record with first 10 chars as, say, XXXXXXXXXX. And its related records will immediately follow this record until next reg num record with XXXXXXXXXX is found.
So the detail rec will look something like below.
Code: |
HEADER......
XXXXXXXXXXABC1234567890 CCYYMMDD etc --> First reg num
UVVYY ABC1 DEF1 etc
UWWYYZ ABD3 DRREF1 etc
NNMMMZZ BCHH2 DEF1 etc
FFFWWYYZ SABD3 DRREF199 etc
XXXXXXXXXXDEF1357902468 CCYYMMDD etc --> Second reg num
UVVYY ABC1 DEF1 etc
UWWYYZ ABD3 DRREF1 etc
NNMMMZZ BCHH2 DEF1 etc
FFFWWYYZ SABD3 DRREF099 etc
UVVYY ABC2 DEF5 etc
UWWYYZ ABD4 DRREF4 etc
NNMMMZZ BCHH5 DEF3 etc
FFFWWYYZ SABD6 DRREF299 etc
.
.
TRAILER....... |
XXXXXXXXXX - identifies the rec where reg num is present. In above example ABC1234567890 has 4 detailed records and DEF1357902468 has 8.
Similary there will be many registration number with varying detailed records under each reg num.
I have a list of reg nums with me for which I want to copy out those reg num and its detailed records to another file. I just explained the example with one file. In real case, I've 100 files to deal with.
So could you please help me out to achieve this using sort. And if its not possible, any other efficient method by which I can achieve this.
Thanks a lot in advance. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
krish.deepu,
If there is a way to identify the reg num XXXXXXXXXX record in each group, use WHEN=GROUP and PUSH your reg num across each record in the group, then JOIN with your list of reg nums. |
|
Back to top |
|
|
krish.deepu
New User
Joined: 27 May 2014 Posts: 4 Location: India
|
|
|
|
Thanks.. will try that out. |
|
Back to top |
|
|
|