by steve-myers » Wed Dec 21, 2011 7:11 pm
Yes, but ...
First you must determine where the dataset is located; either by having the location provided to you or by using the catalog LOCATE and CAMLST macros. LOCATE and CAMLST will not retrieve all the volumes where a multiple volume dataset is cataloged, but they will always retrieve the first volume. Many years ago there was an undocumented "super LOCATE" that could retrieve all the volumes. "Super LOCATE" is still not documented, but now you can use IGGCSI00 to retrieve all the volumes for a dataset from the catalog. IGGCSI00 is a program your program calls using the LINK macro or something similar; it is not a macro.
Then you can obtain the format 1 or format 9 DSCB for the dataset. The "classic" way is to use the OBTAIN and CAMLST macros, now you can use newer macros that conceptually query the VTOC index.
LOCATE, OBTAIN, and CAMLST are documented in DFSMSdfp Advanced Services for your release. The IECSDSL1 macro defines the data area of the format 1 DSCB and format 9 DSCBs as well as most of the other DSCBs in a VTOC.
The CAMLST macro constructs a data area used by the LOCATE and OBTAIN macros.
If your real goal is to determine if the dataset exists, you can use the DALRTORG key in dynamic allocation. DALRTORG retrieves the format 1 or format 9 DSCB for the first volume of a dataset, and copies DSxDSORG field to the DALRTORG key.
The only way to determine if a tape dataset exists is to actually attempt to open the dataset after dynamic allocation has mounted the volume. If the dataset does not exist on the volume OPEN will abnormally terminate with an x13 ABEND.