Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 23
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: 7314

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: 23
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: 7314

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: 23
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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts INVALID RECFM FOR DDNAME SYSLIN AND C... sandeep kumar302 All Other Mainframe Topics 7 Fri Apr 27, 2018 6:07 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Repeat Sequence Number Until change i... rahulabvp DFSORT/ICETOOL 6 Thu Mar 29, 2018 12:51 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us