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
 

 

Syncsort - Find a records having count greater than five

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

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Tue Dec 30, 2008 7:30 pm    Post subject: Syncsort - Find a records having count greater than five
Reply with quote

I have a VSAM file with 200 byte record length. In that file I need to process a record which has a count greater than 5 with some condition. Is there any optimized way to find the records in the VSAM file which has count greater than 5.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Dec 30, 2008 10:58 pm    Post subject:
Reply with quote

You can use a DFSORT/ICETOOL job like the following to only keep records with keys that occur more than 5 times:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (VSAM)
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(p,m,f) HIGHER(5) VSAMTYPE(F)
/*


For p,m,f, substitute the starting position, length and format of the key you want to use, e,g, 5,4,CH. I assumed your VSAM file can be processed as fixed length records. If it must be processed as variable length records, change VSAMTYPE(F) to VSAMTYPE(V) and add +4 to p, e.g. 9,4,CH.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Manigandan Aravindhan

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Wed Dec 31, 2008 10:36 am    Post subject:
Reply with quote

Thanks Frank Yaeger. It's really more helpful. I will go thru the publib link provided by you.

One more question here is that..
I need to keep one or more column as a key value and i need to process only maximum of four records in the VSAM file for each key value.

This question is completely different from the above one.

Thanks in advance.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Dec 31, 2008 9:44 pm    Post subject:
Reply with quote

Quote:
I need to keep one or more column as a key value and i need to process only maximum of four records in the VSAM file for each key value.


It's not clear from this description what you want to do.

Please show an example of the records in the input file (relevant fields only) and what you expect for output. State whether you want to process the VSAM input file as F or V. Give the starting position, length and format of each relevant field according to whether you want to process the VSAM input file as F (first data byte starts at position 1) or V (first data byte starts at position 5).
Back to top
View user's profile Send private message
Manigandan Aravindhan

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Mon Jan 05, 2009 1:32 pm    Post subject:
Reply with quote

Sorry for the inconvenience caused Frank Yaegar. Please find the examples below:

Sample Records in VSAM
================
Q142444APPTWI 20010002200707050035ALL0001
Q142444APPTWI 20060002200707050035ALL0001
Q142444AUTHMN 20010001200108010001 0002
Q142444AUTHMN 20060001200108010001 0001
Q142444AUTHTX 20010002200507010001 0001
Q142444AUTHTX 20060002200507010001 0001
Q142444AUTHTX 20060002200507010001 0001
Q142445AUTHTX 20060002200507010001 0001
Q142445AUTHTX 20060002200507010001 0001
Q142445AUTHTX 20060002200507010001 0001

In the above sample records the key value is from the length 1-6 and 42-45. Keeping the key values i need process a records.
In the first record of the sample VSAM file we have 1-6 as Q14244, I need to process only maximum up to 5 records for Q142444. I need to restrict to process only upto five records for the key value 1-6.

Thanks in advance.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Jan 05, 2009 10:39 pm    Post subject:
Reply with quote

Q141244 is in positions 1-7, not 1-6. Assuming you want to process a maximum of 5 records with each key in positions 1-7, you can use a DFSORT/ICETOOL job like the following:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (VSAM)
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,7,CH) FIRST(5) VSAMTYPE(F)
/*


You'll need z/OS DFSORT PTF UK90013 (July, 2008) to use DFSORT's new FIRST(n) function. If you don't have that PTF, ask your System Programmer to install it (it's free).

For complete details on the new FIRST(n) function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
Manigandan Aravindhan

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Wed Jan 07, 2009 9:57 am    Post subject:
Reply with quote

Thanks Frank Yaeger..icon_smile.gif
Back to top
View user's profile Send private message
Manigandan Aravindhan

New User


Joined: 09 Oct 2007
Posts: 81
Location: India

PostPosted: Wed Jan 07, 2009 12:53 pm    Post subject:
Reply with quote

Please check below:

While executing the JCL im getting the below error
"SELECT FROM(IN) TO(OUT) ON(1,6,CH) FIRST(5) VSAMTYPE(F)
"FIRST" OPERAND IS NOT FOLLOWED BY A BLANK
OPERATION COMPLETED WITH RETURN CODE 12"

I went thru the ICETOOL manual to get to know about syntax:
Syntax:
SELECT FROM(indd) TO(outdd) ON(p,m,f) ...
DISCARD(savedd) ON(VLEN)
ALLDUPS VSAMTYPE(x) UZERO USING(xxxx)
NODUPS
HIGHER(x)
LOWER(y)
EQUAL(v)
FIRST
LAST
FIRSTDUP
LASTDUP

For the keyword first there is no operator like first(x).

Can you please clarify it.

Thanks in advance
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jan 07, 2009 10:50 pm    Post subject:
Reply with quote

Did you just skip over this statement in my post:

Quote:
You'll need z/OS DFSORT PTF UK90013 (July, 2008) to use DFSORT's new FIRST(n) function. If you don't have that PTF, ask your System Programmer to install it (it's free).

For complete details on the new FIRST(n) function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/


FIRST(n) is a NEW function provided by that PTF and described in the doc for that PTF. You need that PTF to use FIRST(n). Your SELECT statement works fine with DFSORT with that PTF. So you obviously don't have that PTF. If you have DFSORT, ask your System Programmer to install that PTF.

However, the messages you received seem to indicate that you have Syncsort, not DFSORT. Syncsort does NOT support the FIRST(n) function.

If you do have Syncsort, then you should be posting in the JCL Forum, not in the DFSORT Forum.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Sat Jan 17, 2009 12:39 am    Post subject:
Reply with quote

Manigandan,

SyncSort for z/OS 1.3.2 supports the FIRST(n) function. Please feel free to contact me offline or contact SyncSort Mainframe Product Services directly if you would like to obtain this release. This is a free upgrade for all licensed SyncSort for z/OS customers.

Regards,
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 Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm


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