Description

Syntax

Name field

There is no name that is specified on a AFTER statement.

Operation field

The operation field consists of the characters AFTER, and must be preceded and followed by at least one blank. It can begin in any column.

Parameter field

The AFTER statement has multiple keyword parameters, and the NAME keyword is required. The NAME parameter must be the first parameter on the AFTER statement.

Positional Parameters: None.

Keyword Parameters: An AFTER statement can contain the following keyword parameters:

NAME=name | (name,name, … )
This specifies that the job specified on the preceding GJOB statement, or all of the jobs in the job set specified by the preceding JOBSET statement, must run after a job specified by NAME=. Each name in the list can be a name of a job specified by the GJOB statement or a name of a job set specified by the JOBSET statement.
WHEN=(condition)
This specifies a set of conditions that must be evaluated to determine what processing should occur next. The conditions apply to the parent job in the dependency (the job that is specified on NAME=). Either the processing specified by ACTION= is taken (if the condition is true) or the processing specified on OTHERWISE is taken (if the condition is false).

The default for WHEN= is (RUN AND !ABEND).

The syntax of condition is the same as used for the condition syntax on the IF statement. Supported keywords that can be tested are:

Keyword Use
RC Indicates return code of a job.
ABEND Indicates that an ABEND condition occurred.
¬ABEND Indicates that no ABEND condition occurred.
ABENDCC Indicates a specific system or user ABEND code.
FAIL Indicates that a job ended abnormally due to one of the following conditions: job ended by CC, a JCL error was detected, the job failed in end-of-memory, or the job failed in conversion.
¬FAIL Indicates that a job did not end abnormally due to one of the preceding conditions.
RUN Indicates that the job was executed.
¬RUN Indicates that the job was flushed from the job group.

The operators that you can use are:

Operator                    Operation                       Order
--------                    ---------                       -----

NOT operator:

Not or ¬ or !               NOT                             first

Comparison operators:

GT  or  >                   Greater than                    second
LT  or  <                   Less than                       second
NG or ¬> or !>              Not greater than                second
NL or ¬< or !<              Not less than                   second
EQ  or  =                   Equal to                        second
NE or ¬= or !=              Not equal to                    second
GE  or  >=                  Greater than or equal to        second
LE  or  <=                  Less than or equal to           second

Logical operators:

AND or  &                   AND                             third
OR  or  |                   OR                              third
Examples of WHEN=:
WHEN=(RC=4 | RC=8)
WHEN=(!ABEND AND RC=8)
WHEN=(ABENDCC=S0C4 OR ABENDCC=U1024)
ACTION=SATISFY|FLUSH|FAIL
Processing to perform if the WHEN condition is true. The valid values are:
SATISFY
The dependency is considered satisfied. This is the default.
FLUSH
The dependency is considered flushed. The dependent job might be flushed, depending on the FLUSHTYP=ALLFLUSH/ANYFLUSH value of the dependent job.
FAIL
The failure of this dependency marks the job group in error. The ONERROR= action from the JOBGROUP statement is taken as a result of the failure.
OTHERWISE=FLUSH|FAIL|SATISFY
Processing to perform if the WHEN condition is false. The valid values are:
FLUSH
The dependency is considered flushed. The dependent job might be flushed, depending on the value FLUSHTYP=ALLFLUSH/ANYFLUSH of the dependent job. This is the default.
FAIL
The failure of this dependency marks the job group in error. The ONERROR action from the JOBGROUP statement is taken as a result of this failure.
SATISFY
The dependency is considered satisfied.

Comments field

The comments field follows the parameter field after at least one intervening blank space.

Location in the JCL

The AFTER statement is valid within a job group context and must follow a GJOB or a JOBSET statement.

Error on AFTER statement

If the system finds an error on the AFTER statement, an HASP1112 message is issued which describes the error. See z/OS JES2 Messages for more information about the message.

Example of AFTER statements

//GRP1    JOBGROUP
//JOB1    GJOB
//JOB2    GJOB
//         AFTER NAME=JOB1,WHEN=(RC=0)
//JOB3    GJOB
//         BEFORE NAME=JOB1
//GRP1    ENDGROUP