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

limiting number of records by key


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Fri May 11, 2012 2:09 am
Reply with quote

Hi All !

I need to select a specific number of records of different keys. I mean, considering the example below:

INPUT - VB - LRECL=4000 - key in pos 1, length 4, numeric
0001 xxxx 0001
0000 xxxx 0002
0001 yyyy 0003
0099 aaaa 0004
0000 bbbb 0005
0004 bbbb 0006
0002 cccc 0007
0002 aaaa 0008
0099 aaaa 0009
0000 xxxx 0010
0001 xxxx 0011
0099 aaaa 0012
0003 cccc 0013

Output file should appear like this: (VB, lrecl=4000)

0000 xxxx 0002
0000 bbbb 0005
0001 xxxx 0001
0001 yyyy 0003
0002 cccc 0007
0002 aaaa 0008
0003 cccc 0013
0004 bbbb 0006
0099 aaaa 0004
0099 aaaa 0009

Each key with 2 records at maximum.

Could i use syncsort to do this?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri May 11, 2012 2:35 am
Reply with quote

First two, last two, any two, two with highest or lowest figure, what?
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Fri May 11, 2012 2:40 am
Reply with quote

First two.
Sorry i considered that my example was clear.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri May 11, 2012 3:05 am
Reply with quote

Well, showing unsorted data for the input and just example output without the rules is not clear.

Sort the file on the key.
On OUTREC use GROUP on your key and PUSH a SEQuence number. You have a variable-length record file, so put your sequence in the "fixed" part, right up at the front is easiest.
Your key does not start at 1 for a length of 4, because, with VB, you need to take the RDW into account. Your key is 5 for a length of 4.
On OUTFIL INCLUDE=(whereyourseqis,yourlength,ZD,LE,2) with BUILD to only include the RDW and the original part of the record.
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Fri May 11, 2012 3:24 am
Reply with quote

Thanks for your response Bill.
I'll try this and reply if any problem.
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 -> JCL & VSAM

 


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 Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top