Using the SYSDSN Function
The SYSDSN function
determines if a specified data set is available for your use. If
the data set is available for your use, it returns "OK".
available = SYSDSN('myrexx.exec')
/* available could be set to "OK" */
When a data set is not correct as specified or when a data set
is not available, the SYSDSN function returns one of the following
messages:
MEMBER SPECIFIED, BUT DATASET IS NOT PARTITIONED
MEMBER NOT FOUND
DATASET NOT FOUND
ERROR PROCESSING REQUESTED DATASET
PROTECTED DATASET
VOLUME NOT ON SYSTEM
UNAVAILABLE DATASET
INVALID DATASET NAME, data-set-name:
MISSING DATASET NAME
When you specify a fully-qualified data set, be sure to use two
sets of quotation marks as follows; one set to define a literal string
to REXX and the other set to indicate a fully-qualified data set to
TSO/E.
x = SYSDSN("'proj5.rexx.exec'")
or x = SYSDSN('proj5.rexx.exec'')
When you specify a data set that is not fully-qualified and begins
with your prefix (usually your user ID), you can use one set of quotation
marks or none at all. TSO/E adds your prefix to the data set name
whether or not it is enclosed within a set of quotation marks.
x = SYSDSN('myrexx.exec')
or x = SYSDSN(myrexx.exec)
When you specify a variable that was previously set to a data set
name, do not enclose the variable in quotation marks. Quotation
marks would prevent the data set name from being substituted for the
variable name.
variable = 'myrexx.exec'
x = SYSDSN(variable)
The following example uses the SYSDSN function together with the
LISTDSI function to test whether a data set exists and whether it
is a partitioned data set:
DO FOREVER
SAY 'Enter a Data Set Name'
PARSE UPPER PULL dsname
IF SYSDSN(dsname) ¬= 'OK' THEN ITERATE
FC = LISTDSI(dsname)
IF SYSDSORG ¬= 'PO' THEN ITERATE
SAY 'Okay: ' dsname 'is ' SYSDSORG
LEAVE
END
The SYSDSN function can be used only in REXX execs that run in the TSO/E address space.