Check the existance of the data in VSAM in CICS program.
Check the existance of the data in VSAM in CICS program.
Hi,
We have a VSAM file with merchant number details. On a CICS map, the user will enter a merchant number. The condition I want to check is that if the merchant number is exists in the VSAM only then the next map should be displayed on screen. What is proper way to check merchant number in the VSAM for this? Please suggest me on this.
We have a VSAM file with merchant number details. On a CICS map, the user will enter a merchant number. The condition I want to check is that if the merchant number is exists in the VSAM only then the next map should be displayed on screen. What is proper way to check merchant number in the VSAM for this? Please suggest me on this.
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Check the existance of the data in VSAM in CICS program.
Your question, as posted, is so fuzzy as to not be answerable.
If you have a VSAM KSDS (which is common), and the merchant number is the key then just use a CICS READ against the VSAM data set. The response code will tell if you that record exists. If the merchant number is not the key, then you'll have to build the key and read (possibly a number of records) to determine if the merchant number exists.
If the VSAM data set is not KSDS, then you'll need to work with your team lead / coworkers to determine how to tell if the merchant number exists.
There is no "proper" (I assume you meant standard) way to do this -- it all depends upon the application and how the VSAM data set is laid out.
Well, VSAM data sets (they are NEVER "files" -- files is a term on the mainframe used for Unix System Services which runs as part of z/OS) can be sequential (ESDS), indexed (KSDS), relative (RRDS), and linear. Since you did not tell us which type of VSAM data set you are dealing with, that makes the question pretty much unanswerable as written.We have a VSAM file with merchant number details.
If you have a VSAM KSDS (which is common), and the merchant number is the key then just use a CICS READ against the VSAM data set. The response code will tell if you that record exists. If the merchant number is not the key, then you'll have to build the key and read (possibly a number of records) to determine if the merchant number exists.
If the VSAM data set is not KSDS, then you'll need to work with your team lead / coworkers to determine how to tell if the merchant number exists.
There is no "proper" (I assume you meant standard) way to do this -- it all depends upon the application and how the VSAM data set is laid out.
- enrico-sorichetti
- Global Moderator
- Posts: 843
- Joined: Wed Sep 11, 2013 3:57 pm
Re: Check the existance of the data in VSAM in CICS program.
by using the appropriate handle condition for the record not found errorWhat is proper way to check merchant number in the VSAM for this? Please suggest me on this
Code: Select all
EXEC CICS HANDLE CONDITION
...
NOTFND(X000-NOT-FOUND-PARA)
...
END-EXEC.
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

Re: Check the existance of the data in VSAM in CICS program.
File is KSDS. And merchant number is the key for it.Robert Sample wrote:Your question, as posted, is so fuzzy as to not be answerable.Well, VSAM data sets (they are NEVER "files" -- files is a term on the mainframe used for Unix System Services which runs as part of z/OS) can be sequential (ESDS), indexed (KSDS), relative (RRDS), and linear. Since you did not tell us which type of VSAM data set you are dealing with, that makes the question pretty much unanswerable as written.We have a VSAM file with merchant number details.
If you have a VSAM KSDS (which is common), and the merchant number is the key then just use a CICS READ against the VSAM data set. The response code will tell if you that record exists. If the merchant number is not the key, then you'll have to build the key and read (possibly a number of records) to determine if the merchant number exists.
If the VSAM data set is not KSDS, then you'll need to work with your team lead / coworkers to determine how to tell if the merchant number exists.
There is no "proper" (I assume you meant standard) way to do this -- it all depends upon the application and how the VSAM data set is laid out.
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Check the existance of the data in VSAM in CICS program.
Do a direct key read of the VSAM data set using the key. You can use HANDLE or the response code to determine how to proceed, based on whether or not the merchant key is found.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute