Chapter Contents

Previous

Next
ABORT

ABORT



Stops the execution of the current DATA step, SAS job, or SAS session

Valid: in a DATA step
OS/390 specifics: action of ABEND and RETURN, maximum value of n


Syntax
Details
See Also

Syntax

ABORT <ABEND | RETURN> <n>;

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 abnormal termination of the current SAS job or session. This also terminates the step in your OS/390 job stream that was used to execute your SAS job. Because the step terminates abnormally, the physical files that were allocated to the step are handled as specified by the abnormal-termination condition of the DISP parameter for those data sets. (The DISP parameter is specified in the JCL DD statement or the TSO ALLOCATE command, in the SAS FILENAME or LIBNAME statement, or in the SAS FILENAME or LIBNAME function.)

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 the 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 OS/390 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 OS/390, 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; an ABORT RETURN statement returns condition code 20.


Details

You can use the ABORT statement to control the conditional execution of OS/390 job steps. For example, depending on the result of the OS/390 job step that executes your SAS program, you may need to either bypass or execute later steps. To do this 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 OS/390 job step to ABEND if ERRCODE=16:

if errcode=16 then abort abend;

When the OS/390 job step that is used to execute your SAS job ends (either normally or abnormally), the next OS/390 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

See Also


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.