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

Copy set of records based on condition


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

New User


Joined: 27 May 2014
Posts: 4
Location: India

PostPosted: Thu Mar 08, 2018 11:39 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 09, 2018 12:43 am
Reply with quote

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
View user's profile Send private message
krish.deepu

New User


Joined: 27 May 2014
Posts: 4
Location: India

PostPosted: Mon Mar 12, 2018 5:30 pm
Reply with quote

Thanks.. will try that out.
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 VB to VB copy - Full length reached SYNCSORT 8
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top