:ATTACH_SYNC
Use the :ATTACH_SYNC script statement to attach a Sync object to a task that has already been activated. This script statement assigns the Sync object temporarily, for the current execution only.
Important! :ATTACH_SYNC does not affect Script objects. Script objects are complete after their generation stage, and the synchronization process takes place at a later point in time.
Usage
Assigning a Sync Object to the Current Task
Omit the RunID in the parameters, or specify the RunID of the current task, to assign the Sync object to the current task.
Assigning a Sync Object to a Different Task
Specify the RunID as a parameter of :ATTACH_SYNC to assign the Sync object to a different task than the task that contains the script.
Important! Only assign a Sync object to a different task that has already been activated if the task has one of the following statuses:
- The task has not yet started (system return code < 1540)
- The task is in a waiting condition (system return code between 1600 and 1700)
Any other task status results in a runtime error and the script is canceled.
Assigning a Sync Object to the Direct Successor in the Workflow
Use the NEXT_OBJECT parameter to assign the Sync object to the successor of the task in the Workflow, to influence further processing.
Notes:
- When you use :ATTACH_SYNC to assign a Sync object to a successor, there must not be more than one successor.
- The Generate Task at: Runtime option must be activated in the task that contains the script statement.
- The task must already be activated, and have its own RunID.
Syntax
:ATTACH_SYNC [Object type,] [RunID], Sync object, [Start action], [Abend action], [End action], Other, [NEXT_OBJECT]
Parameters
| Parameter | Format | Description |
|---|---|---|
| Object type |
script literal or script variable |
(Optional) Short label of the type of executable object to attach the Sync object to. Note: The object can be identified by the RunID alone. |
| RunID | script literal, script variable, or number |
(Optional) RunID of the task to attach the Sync object to. Notes:
|
| Sync object | script literal or script variable |
Name of the Sync object with which to synchronize the task. |
| Start action | script literal or script variable |
(Optional) Action to carry out when the task starts. |
| Abend action | script literal or script variable |
(Optional) Action to carry out if the task ends abnormally. |
| End action | script literal or script variable |
(Optional) Action to carry out when the task ends. |
| Other | script literal or script variable |
Task handling if the start action cannot be processed. Allowed values:
|
| NEXT_OBJECT | script literal or script variable |
(Optional) Assigns the Sync object to the direct successor in a Workflow. |
Note: The Start, End, and Abend actions are defined in the Sync object. For more information, see Sync (SYNC).
Examples
The following script adds a Sync object (SYSTEM_0001_EXCLUSIVE_SYNC) to a Job called ARCHIVE01. If the start action cannot be executed, the job ends abnormally.
:SET &RUNNR# = GET_UC_OBJECT_NR(ARCHIVE01)
:ATTACH_SYNC &RUNNR#,"SYSTEM_0001_EXCLUSIVE_SYNC","USE","RELEASE","RELEASE","A"
In the following example, the Sync object is assigned to the directly succeeding task in the Workflow.
:ATTACH_SYNC ,"SYSTEM_0001_EXCLUSIVE.SYNC","USE","RELEASE","RELEASE","A","NEXT_OBJECT"
See also: