Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ task_definition(1) — ACMSxp 3.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exception(1)

exception_handler(1)

statement(1)

statement_block(1)

task_attribute(1)

task_group(1)

transaction_block(1)

acmsxp_introduction(1)

task definition(1)  —  Commands

Digital

NAME

TASK - specifies execution flow of one or more transactions, sequences access to resources and calls to procedures, and handles exceptions
 

SYNOPSIS

 
Noncomposable Task
 
 TASK <task-name> IN <task-group-name>
 
    [ <task arguments>  ]
    [ <task attributes> ]
 
    [ <assignment statement> |
      <audit statement> |
      <control field statement> |
      <exit task statement> |
      <get message statement> |
      <go to statement> |
      <if then else statement> |
      <raise exception statement> |
      <select first true of statement> |
      <while do statement>
    ] [ ... ]
 
    [ <statement block> [ <exception handler> ] |
         [ <exit block statement> ] |
      <transaction block> [ <exception handler> ]
        [ <call presentation statement> |
          <call procedure statement> |
          <call task statement> |
          <cancel task submit statement> |
          <dequeue statement> |
          <enqueue record statement> |
          <read queue statement> |
          <restart transaction statement> |
          <submit task statement> |
        ]  [ ... ]
    ]  [ ... ]
  END TASK ;
 
Composable Task
 
  COMPOSABLE TASK <task-name> IN <task-group-name>
 
      [ <task arguments>  ]
      [ <task attributes> ]
 
      [ <assignment statement> |
        <audit statement> |
        <transactional call presentation statement> |
        <call procedure statement> |
        <call task statement> |
        <cancel task submit statement> |
        <control field statement> |
        <dequeue statement> |
        <enqueue record statement> |
        <exit task statement> |
        <get message statement> |
        <go to statement> |
        <if then else statement> |
        <raise exception statement> |
        <read queue statement> |
        <restart transaction statement> |
        <select first true of statement> |
        <submit task statement> |
        <while do statement> |
      ]  [ ... ]
 
      [ <statement block> [ <exception handler> ]
           [ <exit block statement> ]
      ] [ ... ]
  END TASK ;
 

PARAMETERS

 

       •task-name
 
A qualified external identifier giving a name unique within the task group specification. See the section titled User-Defined Words in the stdl_syntax man page.  The task name defined in the task definition is used in the task group specification to include the task in a task group. 
 
Task names for tasks called from C user-written clients have certain restrictions.

       •task-group-name
 
An unqualified external identifier giving the name of the task group appearing in the task group specification.

       •task arguments
 
The task arguments define the workspaces passed into and out of the task.  See the task_argument man page. 

       •task attributes
 
A task attribute defines the characteristics of a task. See the task_attribute man page. 
 

DESCRIPTION

 
Each task definition specifies whether the task executes within the caller’s transaction. If the task does not execute within the caller’s transaction, the task is noncomposable. If the task does execute within the caller’s transaction, the task is composable.
 
The major part of STDL syntax is contained within the task definition. A task can include several levels of nested executable statements. Normal execution of a task consists of the execution of any statements, including those that end with explicit flow control (the EXIT BLOCK, EXIT TASK, and GO TO statements). Normal execution also returns to a calling task the workspaces specified in the task arguments as OUTPUT and INOUT.
 
The task definition specifies:

oNoncomposable or composable task

oOptional task arguments

oOptional task attributes

oStatement or statements

The types of blocks that you can use depend on whether the task is noncomposable or composable. 
 
Deviation from the normal execution flow occurs when a statement completes with an exception. The flow depends on whether the task is noncomposable and what types of exception handlers are in effect.
 

Noncomposable Task

 
A noncomposable task executes outside the transaction of a caller. In a noncomposable task, you can have the following types of blocks:

oTransaction block
 
Because of its independence from the transaction of a caller, a noncomposable task’s transactions begin in a transaction block of the task itself. A transaction block identifies a set of transactional operations that execute in the same transaction. A transaction block contains the set of operations for inclusion in the transaction.
 
All of the statements usable outside a transaction block are also usable within a transaction block. However, all the statements shown as usable within a transaction block must only be used within a transaction block in a noncomposable task.
 
The transaction block also groups the operations into a single unit for an optional exception handler that handles any transaction exceptions occurring within the transaction block.

oStatement block
 
A statement block groups multiple statements into a single unit for an exception handler. If the statement is contained within a transaction block, the exception handler associated with the statement block handles only nontransaction exceptions. If the statement block contains a transaction block or blocks, the exception handler associated with the statement block handles transaction exceptions that occur within the enclosed statement block.

 
If a noncomposable task uses EXIT TASK, it can specify WITH COMMIT or WITH ROLLBACK only within a transaction block.
 
If the following statements are used in a noncomposable task outside a transaction block, they must not refer to any transactional workspace fields.
 
  Assignment
  AUDIT
  GET MESSAGE
  RAISE EXCEPTION
 
If a CONTROL FIELD statement is used in a noncomposable task outside a transaction block, the control match and control values must not refer to transactional workspace fields. If the following statements are used in a noncomposable task outside a transaction block, a Boolean expression must not refer to any transactional workspace fields.
 
  IF THEN ELSE
  SELECT FIRST TRUE OF
  WHILE DO
 
Normal execution flow for a noncomposable task is:

     1.Initialize the workspaces in the task arguments defined as INPUT and INOUT with data passed from the caller. 

     2.Execute any statement list. If the statement list terminates with explicit flow control, the explicit flow control is ignored. 

     3.Return to the caller the workspaces defined in the task arguments as OUTPUT and INOUT. 
 

Composable Task

 
A composable task executes within the transaction of the caller. Because of its inclusion within the transaction of the caller, a composable task cannot:

oInclude a transaction block. 
 
The task must execute within the caller’s transaction.

oInclude a CALL PRESENTATION with a nontransactional work attribute and a send exchange or a receive exchange. 
 
The send or receive exchange must be transactional because the task executes within the caller’s transaction.

oInclude a CALL PRESENTATION with a transceive exchange. 
 
A transceive exchange cannot be transactional.

 
In a composable task, you can have statement blocks. A statement block groups multiple statements into a single unit for an exception handler that, in a composable task, handles only nontransaction exceptions.
 
Normal execution flow for a composable task is:

     1.Initialize workspaces defined in the task arguments as INPUT and INOUT with data passed from the caller. 

     2.Execute any statement or statement list. If any statement ends with explicit flow control, the explicit flow control is ignored. 

     3.Return to the caller the workspaces defined in the task arguments as OUTPUT and INOUT. 
 

EXCEPTIONS

 
In the noncomposable task, deviation from the normal execution flow occurs when the statement list completes with an exception. The task completes, returning the exception to the caller, with the exception type set to nontransaction and the level to propagated. See the exception man page for details about exception types for noncomposable tasks. 
 
In the composable task, deviation from the normal execution flow occurs when a statement completes with an exception with the level set to propagated. The type of returned exception depends upon the syntax of both the current composable task (for example, whether it is restartable) and the caller. See the exception man page for details about exception types for composable tasks. 
 

RELATED INFORMATION

Syntax: exception(1), exception_handler(1), statement(1), statement_block(1), task_attribute(1), task_group(1), transaction_block(1)

acmsxp_introduction(1)
 
 
 
 
 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026