ABORT Statement: z/OS

Stops the execution of the current DATA step, SAS job, or SAS session.
Valid in: In a DATA step
z/OS specifics: Action of ABEND and RETURN, maximum value of n
See: ABORT Statement in SAS Statements: Reference

Syntax

ABORT <ABEND | RETURN> <n> ;

Optional Arguments

The following options are used primarily in batch processing, although they can be used with any method of running SAS. These options have host-specific characteristics.

ABEND
causes normal z/OS job-step abend processing to occur after the ABORT statement is issued.
RETURN
causes an immediate normal termination of the SAS job or session. The step return code (condition code) should be used to indicate the error. To pass a specific return code back to the operating environment, use the n option. You can then use this return code in your JCL to conditionally execute later steps in your z/OS job stream.
n
enables you to specify an ABEND code or a condition code that SAS returns to the operating environment when it stops executing. The value of n must be an integer. Under z/OS, the range of acceptable values is from 1 to 4095. If you do not specify a value for n, an ABORT ABEND statement returns a user abend 999 ('3E7'x); an ABORT RETURN statement returns condition code 20. ('3E7'x is the hexadecimal expression of 999.) If you issue the ABORT statement without specifying either ABEND or RETURN, and you do not specify a value for n, then the statement returns condition code 16.

Details

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.

See Also

IBM MVS JCL Reference