The DADSM interface returns various return codes for allocation failures. The following rule demonstrates how to notify someone and record the event when an allocation fails on a volume due to either a duplicate dataset condition or a full VTOC or VTOC index condi- tion. The duplicate dataset condition will be logged to a realtime log file called LOG- DUPDS allocated as //LOGDUPDS DD SYSOUT=A in the DIF JCL. The VTOC failure will also be logged to the LOGVTOC DD and TSO user TSOU111 will be notified as well when the failure occurs.
DEFRULE FAILURE
IF &ENVIRON NE (ALLOCATE,EXTEND) THEN EXIT
IF &ENVS NE (EXTENDNV,' ') THEN EXIT
IF &DADSM_RC = 4
THEN ISSUE WRITEMSG(MSGDUPDS)
IF &ENVIRON = (ALLOCATE,EXT*)
&DADSM_RC = 8
THEN ISSUE WRITEMSG(MSGVTOC)
DEFMSG MSGDUPDS
“ALLOCATION FAILED ON &VOLSER FOR DUPLICATE “ +
“DATASET &DSNAME” LOG(LOGDUPDS,ONLY)
DEFSMF MSGVTOC
“ALLOCATION FAILED ON &VOLSER DUE TO FULL “ +
“VTOC OR VTOC INDEX” LOG(LOGVTOC)
USERID(TSOU111)