Page 1 of 1

Need help in READing VSAM file for a situation

PostPosted: Sun Jun 20, 2010 11:59 am
by kamal
Hi All
I need to read a VSAM file with 10 bytes long key.
05 WS-KEY-FULL.
10 WS-KEY-PART1 PIC X(05).
10 WS-KEY-PART2 PIC X(05).

I have to show all the records on screen (paging) having some value in PART2 of the key
User enters PART2 on the screen. I get PART2 value from screen and display data pagewise.

This VSAM file has `10 million records.

Please suggest effective way of doing it.
1.Readnext commands:
Which format of readnext command can be used ?
2.Alternate Index:
I am not aware if there are any filesize constrains on reading alternate index.

Re: Need help in READing VSAM file for a situation

PostPosted: Sun Jun 20, 2010 5:21 pm
by Robert Sample
Your first option is not a good one. Generic key reads require you start at the first byte of the key. Since you are starting from the sixth byte of the key, you would have to use READ NEXT to read every record in the file to select the records you want.

Alternate index (AIX) may -- and that depends upon your data -- work. The key relevant limit is that an AIX with duplicates is limited to 32767 occurrences. If any of your PART2 values occurs more than 32767 times, you cannot use alternate index -- in which case your only choice will be a complete redesign. http://www.redbooks.ibm.com/abstracts/sg246105.html?Open is the VSAM Demystified redbook and a good place to start. Also read the DEFINE ALTERNATEINDEX section in the Access Method Services for Catalogs manual.

Re: Need help in READing VSAM file for a situation

PostPosted: Mon Jun 21, 2010 4:42 pm
by kamal
Thanks for this information.
I will check my Input file(s) if there are duplicates > 32767 @ AIX field.

Re: Need help in READing VSAM file for a situation

PostPosted: Tue Jun 22, 2010 12:47 pm
by kamal
The file has maximum 100 duplicates on AIX field.
I will use alternate Index. Thanks again for guidance.

Re: Need help in READing VSAM file for a situation

PostPosted: Mon Jul 05, 2010 11:30 am
by kamal
I created alternate index and using it behind the screens. Its working fine while browsing.
Now , I need to update BASE cluster , will the AIX file be updated automatically ? It's not happening for me currently.
May be I am not using correct options while creating AIX or FCT entry.
Please advice.

Re: Need help in READing VSAM file for a situation

PostPosted: Sun Jul 11, 2010 8:41 pm
by Robert Sample
Do you have UPGRADE specified in the AIX definition?

Re: Need help in READing VSAM file for a situation

PostPosted: Thu Jul 22, 2010 12:25 pm
by kamal
It's working as expected after using UPGRADE option in the AIX definition.I realised it after posting this Q.
Thanks Robert Sample!

Re: Need help in READing VSAM file for a situation

PostPosted: Thu Jul 22, 2010 4:35 pm
by Robert Sample
Glad to hear you got it working.