IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Syncsort - Find a records having count greater than five


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Dec 30, 2008 10:58 pm
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:

Use [URL] BBCode for External Links
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
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 Developer


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

PostPosted: Wed Dec 31, 2008 9:44 pm
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
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 Developer


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

PostPosted: Mon Jan 05, 2009 10:39 pm
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:

Use [URL] BBCode for External Links
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
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
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 Developer


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

PostPosted: Wed Jan 07, 2009 10:50 pm
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:

Use [URL] BBCode for External Links


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: 496
Location: USA

PostPosted: Sat Jan 17, 2009 12:39 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top