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
 

 

Search VSAM for non-key field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Search VSAM for non-key field
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    Post subject: Re: Search VSAM for non-key field
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Re: Search VSAM for non-key field
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    Post subject:
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    Post subject: Re: Search VSAM for non-key field
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts VSAM RLS=NRI while doing IDCAMS sheersh JCL & VSAM 1 Tue Mar 07, 2017 1:55 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


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