You can use the ABORT statement
to control the conditional execution of
z/OS job steps. For example,
depending on the result of the
z/OS job step that executes your SAS
program, you might need to either bypass or execute later steps. To
enable this control you can establish a variable in your SAS DATA
step program that is set to a particular value whenever an error occurs.
In the following example, we use a variable named ERRCODE that is
set to 16 if an error occurs in the DATA step. You can choose any
variable name and value that are required by your program. Then, use
the following ABORT statement, coded in the THEN clause of an IF statement,
to cause the
z/OS job step to ABEND if ERRCODE=16:
if errcode=16 then abort return;
When the
z/OS job step
that is used to execute your SAS job ends (either normally or abnormally),
the next
z/OS job step is processed. You could then use the following
EXEC statement to conditionally execute that job step if an ABEND
occurs. If ERRCODE is not set to 16, then the ABORT statement is not
executed, and because an ABEND did not occur the job step is bypassed.
//stepname EXEC
PGM=your-program,COND=ONLY
If
a SAS session abends when it is processing an ABORT statement, then
SAS uses the normal termination disposition when it deallocates any
z/OS data set that SAS dynamically allocated during the session as
a part of FILENAME or LIBNAME processing. For more information, see
the description of the DISP option for
FILENAME Statement: z/OS or LIBNAME Statement: z/OS.