Page 1 of 1

How to check whether VSAM is empty or not

PostPosted: Thu Sep 15, 2011 7:16 pm
by gauthamnagpur18
Hi ,

How to check whether VSAM is empty or not? I know how to check for PS file. but i got stuck with VSAM .

Gautham

Re: How to check whether VSAM is empty or not through JCl ?

PostPosted: Thu Sep 15, 2011 7:46 pm
by Robert Sample
How to check whether VSAM is empty or not through JCL ?
This at least partly depends upon what you mean by "empty". A VSAM file that has been defined but never loaded with any records cannot be opened for input -- period. A VSAM file that has been opened for output, had a record written to it, then closed -- even if the record is then deleted -- can be opened for input.

Re: How to check whether VSAM is empty or not through JCl ?

PostPosted: Thu Sep 15, 2011 7:55 pm
by gauthamnagpur18
My Vsam file contains no records .

Thanks,
Gautham

Re: How to check whether VSAM is empty or not

PostPosted: Thu Sep 15, 2011 9:44 pm
by BillyBoyo
Have you tried an IDCAMS LISTCAT for the dataset?

Re: How to check whether VSAM is empty or not

PostPosted: Thu Sep 15, 2011 11:28 pm
by Robert Sample
My Vsam file contains no records .
This may be accurate, but it is completely nonresponsive. A VSAM (note that VSAM is an acronym and should be capitalized in English) file that has no records either (1) has never had any records, or (2) had at least one record that was deleted. For case (1), you must use IDCAMS to do a LISTCAT command on the data set and parse the output looking for the record count -- or use a similar method using the product of your choice -- since you absolutely, positively cannot open the file for input to count the records. For case (2), you can use the utility of your choice to copy the file to a DUMMY data set and get the count of copied records.

Re: How to check whether VSAM is empty or not

PostPosted: Thu Sep 15, 2011 11:31 pm
by gauthamnagpur18
Hi BillyBoyo,

Ya , i know that command . But is it possible through JCl ?

Hi Robert Sample ,

Using flat file we can do .. but my doubt was whether we can check VSAM is empty or not through JCL. :roll:

Thanks ,
Gautham

Re: How to check whether VSAM is empty or not

PostPosted: Thu Sep 15, 2011 11:52 pm
by dick scherrer
Hello,
Ya , i know that command . But is it possible through JCl ?

Using flat file we can do .. but my doubt was whether we can check VSAM is empty or not through JCL.


NO and NO. . .JCL can do nothing execpt execute programs/procedures. What you can do is have JCL execute IDCAMS to see the record count.

Re: How to check whether VSAM is empty or not

PostPosted: Fri Sep 16, 2011 12:00 am
by gauthamnagpur18
Hi dick scherrer,

You mean we can check record count of VSAM cluster ? wow ... it's done .. if record count is zero then its empty .

Thank you . I will try and let you know .

Thanks,
Gautham