Page 1 of 1

Check the existance of the data in VSAM in CICS program.

Posted: Sat Mar 26, 2016 9:53 pm
by Shuku
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.

Re: Check the existance of the data in VSAM in CICS program.

Posted: Sat Mar 26, 2016 10:07 pm
by Robert Sample
Your question, as posted, is so fuzzy as to not be answerable. 
We have a VSAM file with merchant number details.
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.
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.

Re: Check the existance of the data in VSAM in CICS program.

Posted: Sat Mar 26, 2016 10:08 pm
by enrico-sorichetti
 
What is proper way to check merchant number in the VSAM for this? Please suggest me on this
by using the appropriate handle condition for the record not found error  

Code: Select all

EXEC CICS HANDLE CONDITION
    ...
    NOTFND(X000-NOT-FOUND-PARA)
    ...
END-EXEC.
even better, ask Your colleagues, Your support about the standards in place for error handling

Re: Check the existance of the data in VSAM in CICS program.

Posted: Thu Apr 14, 2016 4:58 pm
by Shuku
Robert Sample wrote:Your question, as posted, is so fuzzy as to not be answerable. 
We have a VSAM file with merchant number details.
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.
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.
File is KSDS. And merchant number is the key for it.

Re: Check the existance of the data in VSAM in CICS program.

Posted: Thu Apr 14, 2016 7:30 pm
by Robert Sample
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.

Re: Check the existance of the data in VSAM in CICS program.

Posted: Thu Apr 28, 2016 12:07 pm
by Shuku
Thanks fr the suggestion.