: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.
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.
More Information:
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
-
:ATTACH_SYNC
Attaches a Sync object to an activated task -
Object type
(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
(Optional) RunID of the task to attach the Sync object to
Format: script literal, script variable, or number
Notes:- If you do not specify a RunID, the Sync object is attached to the current object.
- Include the comma even if you omit the RunID.
-
Sync object
Name of the Sync object with which to synchronize the task
Format: script literal or script variable -
Start action
(Optional) Action to carry out when the task starts
Format: script literal or script variable -
Abend action
(Optional) Action to carry out if the task ends abnormally
Format: script literal or script variable -
End action
(Optional) Action to carry out when the task ends
Format: script literal or script variable -
Other
Task handling if the start action cannot be processed
Format: script literal or script variable
Allowed values:- A
Abnormal end (Abend) - W
Wait - S
Skip
- A
-
NEXT_OBJECT
(Optional) Assigns the Sync object to the direct successor in a Workflow
Format: script literal or script variable
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:
seealso