Declare conditional execution of command sequence
Component: | JV |
Functional area: | Job variables |
Domain: | JOB-VARIABLES |
Privileges: | STD-PROCESSING |
This function is available to the user only if the chargeable software product JV has been loaded as a subsystem.
Function
Via the ADD-CJC-ACTION command, the user can make the execution of a CJC (conditional job control) command sequence dependent on a condition. The ADD-CJC-ACTION command defines
the condition under which the CJC command sequence is to be started (operand CONDITION)
the name of the CJC command sequence (operand NAME)
the time period during which the command is to be in effect (operand TIME-LIMIT)
the maximum number of executions of the CJC command sequence (operand REPEAT)
the address (branch destination) of the CJC command sequence to be started in the case: time elapsed and “condition not satisfied” (operand TIMEOUT-LABEL)
The user enters the CJC command sequence following the ADD-CJC-ACTION command. The sequence may contain only ENTER-JOB, ENTER-PROCEDURE- and/or MODIFY-JV commands. ENTER-PROCEDURE is only permitted in a non-S procedure. The whole CJC command sequence between ADD-CJC-ACTION and END-CJC-ACTION is initially only stored.
The following table illustrates the order in which the commands in the sequence are to be entered:
Input | Meaning |
---|---|
| Opens a CJC command sequence; defines the condition and type of execution |
or
or
| CJC command sequence to be started in the case “condition satisfied”; merely stored initially. ENTER-PROCEDURE is only permitted in a non-S procedure. |
or
or
| CJC (TIMEOUT) command sequence to be started in the case “condition not satisfied”; merely stored initially. |
| Closes and activates the CJC command sequence |
Both command sequences (“condition satisfied” or “condition not satisfied”) may be specified.
The END-CJC-ACTION command concludes the CJC command sequence and activates it. Subsequent commands are again executed immediately.
If “condition satisfied” occurs within the defined time period, processing is interrupted and the corresponding CJC command sequence is started. This applies for every “condition satisfied” until the specified time has elapsed or the maximum number of repetitions of the CJC command sequence has been reached. If the condition is already satisfied when the CJC command sequence is specified, the CJC commands are executed immediately.
If the time elapses without the maximum number of “condition satisfied” events having occurred, the TIMEOUT command sequence, if one has been defined, is started. When execution of a CJC command sequence has ended, processing continues from the point at which it was interrupted. If the CJC command sequence corresponding to the command ADD-CJC-ACTION is not given, only the event that fulfills the specified condition is logged by messages.
Format
ADD-CJC-ACTION |
CONDITION = *NONE / <text 0..1800 with-low cond-expr> ,NAME = *NONE / <name 1..8> ,TIME-LIMIT = 600 / <integer 1..65535 seconds> ,TIMEOUT-LABEL = *NONE / <name 1..8> ,REPEAT = 1 / <integer 1..32767> |
Operands
CONDITION = *NONE / <text 0..1800 with-low cond-expr >
Conditional expression (enclosed in parentheses). The CJC command sequence is executed as soon as “condition satisfied” occurs. The permissible entries are described in section "Conditional expressions (job variables)". Uppercase and lowercase letters are differentiated. Special job variables are not permitted here. The default setting is *NONE, i.e. only a TIMEOUT command sequence can be started (see the TIMEOUT-LABEL operand). Commands before the TIMEOUT mark and a REPEAT value greater than 1 are rejected.
NAME = *NONE / <name 1..8>
Name for the ADD-CJC-ACTION command. This name is displayed in messages beside the internal identification. The ADD-CJC-ACTION command can be referred to using this name. If the name specified is identical to the name of an ADD-CJC-ACTION command still in effect, the entry is accepted but a warning message is issued. The default is *NONE, i.e. messages show only the identification assigned by the system. The internal identification is then the only means of referring to the ADD-CJC-ACTION command.
TIME-LIMIT = 600 / <integer 1..65535 seconds >
Time specification, in seconds. The CJC command sequence is executed only if “condition satisfied” occurs within the specified time period and the maximum number of repetitions (REPEAT operand) is not exceeded.
The countdown begins after the END-CJC-ACTION command is executed; the average precision is 200 ms. A time specification greater than 65280 seconds means “unlimited life” (but not beyond job termination).
TIMEOUT-LABEL = *NONE / <name 1..8>
Branch destination. Name of the command with which processing is to be continued if the specified time runs out and the maximum number of “condition satisfied” events has not yet occurred (TIMEOUT command sequence).
The default value is *NONE, i.e. no TIMEOUT command sequence is specified.
If no TIMEOUT command sequence with the specified name is defined at the time END-CJC-ACTION is entered, then
with procedures (interactive/batch): the whole CJC command sequence is rejected.
in dialog (without procedure): a warning is issued and END-CJC-ACTION is rejected.
REPEAT = 1 / <integer 1..32767>
Maximum number of repetitions of the CJC command sequence within the specified period.
Return codes
Return codes relating to the ADD-CJC-ACTION command or the CJC command sequence commands are only returned once the CJC command sequence is terminated with END-CJC-ACTION.
(SC2) | SC1 | Maincode | Meaning |
0 | CMD0001 | CJC command sequence executed | |
1 | CMD0202 | Condition incorrect, syntax error, CJC command sequence command not allowed or unknown, END-CJC-ACTION not found or timeout label does not exist | |
32 | CMD0221 | Internal error | |
130 | CJC0002 | JV not accessible | |
130 | CJC0003 | Memory saturation |
Notes
A CJC command sequence is always viewed by the system as a self-contained unit, i.e. processing must not branch to a CJC command sequence from an external source. For every branching operation to be performed (to a mark or to SET-JOB-STEP, for instance), a search is made for an END-CJC-ACTION following any ADD-CJC-ACTION detected; only then will the search for the desired branch destination be continued.
An ADD-CJC-ACTION command becomes inoperative in the following cases:
The CJC command sequence has been carried out as often as was specified in the REPEAT operand.
The time interval specified in the TIME-LIMIT operand has elapsed and the TIMEOUT command sequence - if present - has been executed.
A REMOVE-CJC-ACTION command has been given.
The job is terminated or aborted.
The catalog containing a job variable involved is permanently exported.
The starting time of a CJC command sequence depends on the mode in which the job is when the event “condition satisfied” occurs:
Program mode:
A system function called from the program is still being executed.
Command mode:
The current command is allowed to terminate.
BREAK/ESCAPE-mode:
The start is delayed until a one of the following commands is entered: CANCEL-/RESUME-PROGRAM or CANCEL-/END-/EXIT-/RESUME-PROCEDURE
WAIT mode or “condition immediately satisfied”:
The start occurs immediately.
If the start of a CJC command sequence is delayed, its definition remains known in the system. Consequently, if BREAK/ESCAPE mode lasts long enough, the first “condition satisfied” event can occur in this time and then also the "TIME-LIMIT reached" event. Correspondingly, after BREAK/ESCAPE mode has been exited, if defined the two parts of the CJC command sequence are executed one after the other:the part delayed so far for "condition satisfied within wait time"
and the part for "wait time expired"
Within the CJC command sequence, only the commands ENTER-JOB, ENTER-PROCEDURE and MODIFY-JV are permitted. ENTER-PROCEDURE is only permitted in a non-S procedure. If an invalid command is specified before the sequence is terminated by END-CJC-ACTION, it is rejected.
Table: Order of commands to be entered in the CJC command sequence ENTER-JOB or ENTER-PROCEDURE is the first command in the TIMEOUT command sequence, any job name that is specified must match the name of the command sequence. Example:
/.ERROR ENTER-JOB JOB.A, JOB-NAME=ERROR
In the event of an error in ADD-CJC-ACTION or in the CJC command sequence, procedures apply (interactive/batch): The ADD-CJC-ACTION command rejected and thus is ineffective; control branches to the next of the following commands (after END-CJC-ACTION): SET-JOB-STEP, EXIT-JOB, LOGOFF, CANCEL-PROCEDURE, END-PROCEDURE or EXIT-PROCEDURE. If END-CJC-ACTION is not specified, the procedure terminates abnormally.
The END-CJC-ACTION command is ignored if the relevant ADD-CJC-ACTION command is missing.
CJC command sequences are automatically provided by the system with an internal identification which can be used in the REMOVE-CJC-ACTION command.
As long as an ADD-CJC-ACTION command is effective, no checkpoint (WRCPT macro) can be written. A restart (RESTART-PROGRAM command) terminates all ADD-CJC-ACTION commands still effective.