View previous topic :: View next topic
|
Author |
Message |
murali.andaluri
New User
Joined: 07 Jun 2013 Posts: 23 Location: USA
|
|
|
|
I have attended client interview, they asked me the following question, please clarify.
There is an empty VSAM file, so whenever I am trying to read this empty VSAM file my JCL step should be abended, so what should I do for this? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
murali.andaluri
New User
Joined: 07 Jun 2013 Posts: 23 Location: USA
|
|
|
|
Hi Dick,
I have tried searching in portal, but didn't get satisfied solution.
He was asking daily we are receiving data in that file, suppose if you receive empty file instead of with data how you will abend your JCL?
Actually interviewer was asking me think whether you can do with listcat, but I didn't understand how to do with Listcat. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Possibly because you can't reliably cause an abend with LISTCAT. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Did you read the posted link?
You can read the output of the LISTCAT programmatically and then issue an abend or a flush depending on the empty /not-empty condition discovered by the LISTCAT. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
In a standalone step, issue an IDCAMS PRINT INFILE(VSAMFILE) COUNT(1). If the file is empty, an RC=04 will be raised.
If the customer worries about exposing delicate file-information from PRINT, specify DD DUMMY for SYSPRINT.
Remember, you're only interested in the return-code. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Note that "some" of the nine won't apply for VSAM without changes... |
|
Back to top |
|
|
murali.andaluri
New User
Joined: 07 Jun 2013 Posts: 23 Location: USA
|
|
|
|
Hi,
I have tried Vasanth first way, but I got RC=16
and
IDC3351I ** VSAM OPEN RETURN CODE IS 160
IDC0005I NUMBER OF RECORDS PROCESSED WAS 0
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12
My dataset is empty so it should set RC=0004, but it is showing RC=16. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Murali, I am not sure if there is a language barrier or what here.
VSAM distinguishes between an empty file (that is, a VSAM file that has been opened for output before, whether or not there is now a record in it), and an unused file (that is, a VSAM file that has never been opened for output -- ever).
The difference is that an unused file CANNOT be opened for input under any circumstances, while an empty VSAM file can be opened for input. If you have just defined a VSAM file in yoiur JCL, and you attempt to open that VSAM file for input before doing anything else -- that attempt will fail, always and forever. Depending upon which program or utility you are using, you might get a file status code or a 12 / 16 step return code, but in all cases the open will not succeed. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Bill Woodger wrote: |
Note that "some" of the nine won't apply for VSAM without changes... |
|
|
Back to top |
|
|
|