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
 

 

how to get first 5 records of key using SYNCSORT

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

New User


Joined: 21 Aug 2006
Posts: 13

PostPosted: Sat Sep 01, 2007 12:37 am    Post subject: how to get first 5 records of key using SYNCSORT
Reply with quote

Hi,
I have a requirement to select first 5 records of key from the input file using Syncsort. the sorting key is 2 byte field and it has values from '01' till '20', I need to get the output file containing 5 records of each '01' till '20' field.
Can anyone help me how do I get the first 5 occurances of keys in Syncsort.

Thanks,
Rajeev
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Sep 01, 2007 1:06 am    Post subject:
Reply with quote

If the restriction to IFTHEN will allow 20 of them, start a seqnum on each key and on output include only the first five....
Back to top
View user's profile Send private message
Rajeev_mainframe

New User


Joined: 21 Aug 2006
Posts: 13

PostPosted: Sat Sep 01, 2007 1:14 am    Post subject: Reply to: how to get first 5 records of key using SYNCSORT
Reply with quote

William,

Can you explain in more detail and if you can provides some samples on this.

Thanks,
Rajeev
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Sep 01, 2007 1:39 am    Post subject:
Reply with quote

If you would check your manual and additional addendems, use the IFTHEN logic to add a sequence number to the record, sort as needed and upon output omit the records with a seqnum greater than five (while striping the seqnum)....
Is your site licensed for Syncsort?
Back to top
View user's profile Send private message
Rajeev_mainframe

New User


Joined: 21 Aug 2006
Posts: 13

PostPosted: Sat Sep 01, 2007 3:23 am    Post subject: Reply to: how to get first 5 records of key using SYNCSORT
Reply with quote

I am not very proficient in SYNCSORT and thats why if you can give some samples as to how do we use IFTHEN in Syncsort, will be of great help.
The test region where I am testing supports SYNCSORT utility. I am first sorting the input file on key and then somehow I have to select first 5 records of each key and output it to another file. I a not aware of syntax in the COND parameter for 'FIRST 5' or IF THEN loop in SYNCSORT. Also I will appreciate if you can direct me to any link which has SYNCSORT manual where i can reference.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Sep 01, 2007 4:23 am    Post subject:
Reply with quote

Get the manuals, it is not that difficult.....
Quote:
Unfortunately, all licensed SyncSort customers must request manuals directly from us, or download it from our website using an online support account. It is in breach of contract for an individual to share SyncSort documentation with others outside of their own company. However, please feel free to pass on my contact info to anyone who is in need of manuals and I would be happy to assist.
Regards,
Alissa
Alissa Margulies
SyncSort Mainframe Support
201.930.8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sun Sep 02, 2007 4:37 pm    Post subject:
Reply with quote

Rajeev_mainframe
Provide some sample set of i/p records and the key position also show your o/p file sample.
In addition to that also provide the RECFM and LRECL of your file's.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sun Sep 02, 2007 5:44 pm    Post subject:
Reply with quote

Rajeev_mainframe
Use this SORT JCL in which the KEY is in 12th position.
The o/p would contain the records that have 5 records for each key.
Code:


//*******************************************************               
//STEP1    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
QWER       01                                                           
 SADF      01                                                           
ASDF       01                                                           
DFHY       01                                                           
SDGF       01                                                           
FGGH       01                                                           
QWER       01                                                           
FGGH       11                                                           
QWER       11                                                           
 SADF      11                                                           
ASDF       11                                                           
DFHY       11                                                           
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(12,2)))     
  OUTFIL INCLUDE=(81,8,ZD,LE,+5),OUTREC=(1,80)                         
/*                                                                     
//                                                                     

SORTOUT contains
Code:
QWER       01 
 SADF      01 
ASDF       01 
DFHY       01 
SDGF       01 
FGGH       11 
QWER       11 
 SADF      11 
ASDF       11 
DFHY       11 


Try implementing this as per your requiremnt, if still unresolved then post the details that i have asked in my previous post
Back to top
View user's profile Send private message
Rajeev_mainframe

New User


Joined: 21 Aug 2006
Posts: 13

PostPosted: Fri Sep 14, 2007 6:08 am    Post subject: Reply to: how to get first 5 records of key using SYNCSORT
Reply with quote

Thnks guys for the replies. I was able to do this through file-aid from option 3.3.
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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