Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

limiting number of records by key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
juares castro

New User


Joined: 04 May 2012
Posts: 18
Location: Brazil

PostPosted: Fri May 11, 2012 2:09 am    Post subject: limiting number of records by key
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri May 11, 2012 2:35 am    Post subject: Reply to: limiting number of records by key
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: 18
Location: Brazil

PostPosted: Fri May 11, 2012 2:40 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri May 11, 2012 3:05 am    Post subject: Reply to: limiting number of records by key
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: 18
Location: Brazil

PostPosted: Fri May 11, 2012 3:24 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts Edit large number of datasets (QSAM) zh_lad TSO/ISPF 3 Tue Apr 04, 2017 6:08 pm
No new posts how to mask the phone number kumarinfy DB2 4 Mon Apr 03, 2017 5:23 pm
No new posts what is meaning of the number in dcl Martylin PL/I & Assembler 2 Thu Mar 09, 2017 7:18 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us