Acquiring processes and activities

Before a program that runs outside a process can activate an activity in the process, it uses the ACQUIRE command to acquire access to the activity. Acquiring an activity enables the program to read and write to the containers for the activity, and to issue various commands, including RUN and LINK, against the activity. If the acquired activity is a root activity, the program can issue the commands against the process.

About this task

To gain access to an activity from outside the process that contains it, you use the ACQUIRE command. An activity that a program accesses with an ACQUIRE command is known as an acquired activity.

There are two forms of the ACQUIRE command:
ACQUIRE ACTIVITYID
Acquires the specified descendant (non-root) activity.
ACQUIRE PROCESS
Acquires the root activity of the specified process.

When a program defines a process, it is automatically given access to root activity for the process. This enables the defining program to access the process containers and root activity containers before running the process. When a program gains access to a root activity with either a DEFINE PROCESS or an ACQUIRE PROCESS command, the process is known as the acquired process.

For reference information about the ACQUIRE command, see ACQUIRE.

Process and activity rules: These rules apply when acquiring or accessing an activity or a process.
  1. A program can acquire only one activity within the same unit of work. The activity remains acquired until the next sync point. This means, for example, that a program:
    • Cannot issue both a DEFINE PROCESS and an ACQUIRE PROCESS command within the same unit of work.
    • Cannot issue both an ACQUIRE PROCESS and an ACQUIRE ACTIVITYID command within the same unit of work. That is, it can acquire either a descendant activity or a root activity, not one of each.
  2. If a program is executing as an activation of an activity, it cannot:
    • Acquire an activity in the same process as itself. It cannot, for example, issue ACQUIRE PROCESS for the current process.
    • Use a LINK command to activate the activity that it has acquired.
  3. A process of an acquired activity is accessible in the same way as the activity itself can access it. Thus, if the acquired activity is a descendant activity:
    • The containers of the process might be read but not updated.
    • The process might not be the subject of any command - such as RUN, LINK, SUSPEND, RESUME, or RESET - that directly manipulates the process or its root activity.
    Conversely, if the acquired activity is a root activity:
    • The containers of the process might be both read and updated.
    • The process might be the subject of commands such as RUN, LINK, SUSPEND, RESUME, or RESET. The ACQPROCESS keyword on the command identifies the subject process as the one the program that issues the command has acquired in the current unit of work.