View previous topic :: View next topic
|
Author |
Message |
Rajeev_mainframe
New User
Joined: 21 Aug 2006 Posts: 13
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Rajeev_mainframe
New User
Joined: 21 Aug 2006 Posts: 13
|
|
|
|
William,
Can you explain in more detail and if you can provides some samples on this.
Thanks,
Rajeev |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Rajeev_mainframe
New User
Joined: 21 Aug 2006 Posts: 13
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Rajeev_mainframe
New User
Joined: 21 Aug 2006 Posts: 13
|
|
|
|
Thnks guys for the replies. I was able to do this through file-aid from option 3.3. |
|
Back to top |
|
|
|