── PROCESS ─┬─ <add statement> ───────────────────┬────────────────────┤ ├─ <bind statement> ──────────────────┤ ├─ <compile statement> ───────────────┤ ├─ <copy statement> ──────────────────┤ ├─ <log statement> ───────────────────┤ ├─ <PB statement> ────────────────────┤ ├─ <run statement> ───────────────────┤ ├─ <RUNX statement> ──────────────────┤ ├─ <start statement> ─────────────────┤ └─ <subroutine invocation statement> ─┘
The PROCESS statement initiates tasks asynchronously. The job does not terminate until all asynchronous tasks have terminated. For more information about task variables, see Using Task Variables.
A task equation list and a task variable can usually be specified when using PROCESS with the statements listed in the syntax diagram. Restrictions are summarized in Task Equation.
If a task variable is attached, a WAIT statement can be used to cause the job to wait for the task to terminate, to reach a particular task state, or to have a particular task attribute value. Refer to WAIT Statement in this section for details. Many attributes of a task can be altered while the task is active by using the task assignment statement. Refer to Assignment Statements earlier in this section for the syntax of the task assignment statement.
The name of a subroutine task initiated by a PROCESS statement is set by WFL when the subroutine is invoked. Prior settings of the NAME task attribute are overridden, and the default name of the subroutine task is the same as the name of the subroutine. The name of the subroutine task can be changed by specifying a different value for the NAME task attribute when the subroutine is invoked.
Care should be taken when using global variables in an asynchronous subroutine, or in a program initiated by a PROCESS RUN with passed-by-reference parameters. This is because the subroutine or program executes in parallel with the rest of the job, and all of the parallel processes that are executing can access the variable at the same time. If one process changes the value of the variable, other processes that interrogate the variable will get the new value.
Note: | A run-time error will result if the PROCESS statement is executed
in either of the following ways:
|
Examples
The following are simple examples of the PROCESS statement:
PROCESS RUN X/Y (3,I) [T]
PROCESS SUB; CORE =100
PROCESS COPY A TO B [T]
This example initiates two copy tasks asynchronously and causes the job to wait for both of them to finish before continuing:
PROCESS COPY (JAS)= FROM PARTS1 (TAPE) TO DATAPK (DISK) [T1]; PROCESS COPY (JAS)= FROM PARTS2 (TAPE) TO DATAPK (DISK) [T2]; DO WAIT UNTIL T1 IS COMPLETED AND T2 IS COMPLETED;
This example runs two programs asynchronously and waits for the first one to complete. According to the TASKVALUE of the first program, the attributes of the second program are changed or else it is aborted:
PROCESS RUN PROG/1 [T1]; PROCESS RUN PROG/2 [T2]; WAIT (T1 IS COMPLETED); IF T2 ISNT COMPLETED THEN BEGIN IF T1 (TASKVALUE) = 1 THEN T2 (SW1=TRUE, OPTION=(ARRAY, DSED)) ELSE ABORT [T2] "T2 ABORTED"; END;
In this example, the prior value of TESTSUB for the NAME task attribute (set with the task variable T) is overridden when the subroutine SUB1 is invoked by a PROCESS statement. The name of the subroutine task is changed from its default value of SUB1 to the value of TEST1:
SUBROUTINE SUB1; BEGIN RUN TEST/1; END; T(NAME=TESTSUB); PROCESS SUB1[T]; NAME=TEST1;