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

Search VSAM for non-key field


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jtwohig

New User


Joined: 24 Jul 2006
Posts: 18

PostPosted: Mon Jul 24, 2006 5:13 pm
Reply with quote

Hi,

I'm having a brain cramp, my VSAM is a little rusty. How would I go about searching a VSAM file for a non-key field (SSN) from a batch Cobol program ? In most cases, the key field value would be available but in some cases I just have non-key field like SSN or EIN to search for.

Thanks!
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Jul 25, 2006 1:56 am
Reply with quote

Tell us a little about you VSAM file.

How many records in the file?
For each run, how many "KEY" accesses will you make?
For each run, how many non 'KEY" accesses will you make?
Can you create alternate index based on access fields? (currently non "KEY")

What order is the driver in (i.e. Input file that drives the process)
How many different non "KEY" fields can you be searching on?

How often do you need to run this process?

Dave
Back to top
View user's profile Send private message
Muthukumar.PLindia

New User


Joined: 03 Jul 2006
Posts: 51
Location: Chennai

PostPosted: Tue Jul 25, 2006 9:26 am
Reply with quote

If you have a non key field, the only way to search the VSAM is sequential access.. U need to read all the records one by one and should check for a match...

If you need it to be dynamic(fetching the exact record) u need the full key of it...

IF you have the partial key(example : if 2 fields constituite a key, and you have the data for one field alone) then u can use Random access method and START statement can be used for searching..

As your scenarios falls under the first case, u can use sequential access alone like a normal PS read.
correct me if i am wrong.

Muthu
Back to top
View user's profile Send private message
mainframemouli

New User


Joined: 01 Mar 2005
Posts: 52
Location: Mysore

PostPosted: Tue Jul 25, 2006 11:49 am
Reply with quote

Have a sequential read for the file
and check for the non-key field....treat the VSAM file as the simple flat file.
Back to top
View user's profile Send private message
jtwohig

New User


Joined: 24 Jul 2006
Posts: 18

PostPosted: Tue Jul 25, 2006 4:43 pm
Reply with quote

Thanks very much to all !!! Looks like the sequential read is my option here.
J.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Jul 25, 2006 5:16 pm
Reply with quote

A sequential read of the VSAM file is not necessarily a good option if the non ?KEY? data is not in the same sort order as the VSAM file, and it probably is not, and depending upon how many records are in the VSAM file, and how many access are going to be made to it.

If there are many records in the VSAM file, and there are more than, well, one access to it, a better solution would be to build a temporary VSAM file with the not ?KEY? data and the ?KEY? of the main VSAM file. This way you build a kind of index into the VSAM file. If you do not have the native ?KEY?, read the temporary VSAM file to retrieve it, then go after the main VSAM file.

Dave
Back to top
View user's profile Send private message
jtwohig

New User


Joined: 24 Jul 2006
Posts: 18

PostPosted: Tue Jul 25, 2006 5:41 pm
Reply with quote

Thanks for your response Dave. Had to hop on to another task but can now describe the files, etc. Input file is in EDI format, so order is totally random and data changes, and is processed, on a daily basis. Due to this, the number of key vs. non-key accesses changes daily. I'd be searching on one non-key field only, SSN/EIN. File is a production file accessed by many other processes. I doubt the addition of an alternate index would occur anytime soon. My process would be access via a batch cobol program. The temporary VSAM file option sounds like it could be do-able. A co-worker also suggested creating a flat file with just the non-key field (SNN/EIN) in it, sorted in the non-key field order since all I want to do is determine whether the SSN/EIN on the input/driver file is on the VSAM file (or its flat file extract). If the SSN/EIN is on the VSAM/flat file, it's selected vs. a "non-hit" in which case it's excluded.
Thanks again,
J.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Jul 25, 2006 5:48 pm
Reply with quote

Best of luck with this. Come back and let us know what your final solution was and how it worked.

Dave
Back to top
View user's profile Send private message
satya123
Warnings : 1

New User


Joined: 18 Aug 2006
Posts: 57

PostPosted: Tue Aug 29, 2006 9:37 am
Reply with quote

Hi all,
please let me know if Vsam file can be accessed by RBA thru COBOL program???I know thru CICS it is possible.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top