# Compaq ACMS for OpenVMS
ADU Reference Manual

Previous | Contents | Index

# GOTO STEP Clause (Action)

> In the action part of a step definition, specifies which exchange, processing, or block step to execute next.

## Format

## Parameter

> ### step-label-name

> The name of an exchange, processing, or block step. The step-label-name is a step label you defined in the task definition; it cannot be an ACMS-defined step label.

## Keywords

> ### NEXT EXCHANGE/PROCESSING/STEP

> Runs the next exchange or processing step in the step block.

> ### PREVIOUS EXCHANGE/PROCESSING/STEP

> Runs the previous exchange or processing step in the step block. BLOCK is not a keyword with the GOTO STEP clause. Therefore, you cannot specify NEXT or PREVIOUS BLOCK.

## Clause Default

> The GOTO STEP clause is optional; the default action for steps within a block is GOTO NEXT STEP.

## Note

> If you use the GOTO STEP clause within a conditional clause (CONTROL FIELD, IF THEN ELSE, SELECT FIRST, or WHILE DO), the GOTO STEP clause cannot point to a step that is outside the conditional clause. For example, a GOTO STEP clause within an IF THEN ELSE conditional clause cannot point to a step that appears before the IF keyword or after the END IF keywords.

> You cannot use the GOTO STEP clause in the action part of a root block or root processing step.

> If you use the GOTO STEP clause in the action part of a nested block, it can point to the beginning of the same block or to an exchange, processing, or block step within the parent block.

> If you use the GOTO STEP clause in the action part of an exchange or processing step, it can point to any step within the same block step.

> Figure 3-11 shows a sample nested blocks arrangement and indicates the acceptable GOTO STEP statements for the action part of each step in the structure.

## Example

    GET_FIVE_EMPLOYEES:
      PROCESSING
        CALL REVIEW_SCHEDULE_GET IN DEPARTMENT_SERVER
          USING REVIEW_SCHEDULE_WKSP;
        CONTROL FIELD ACMS$T_STATUS_TYPE
          "B"        : GET ERROR MESSAGE;
                       GOTO PREVIOUS EXCHANGE;
        END CONTROL FIELD;

> If the REVIEW_SCHEDULE returns a status code with an error severity level of WARNING, ERROR, or FATAL, ACMS stores the value "B" in the ACMS$T_STATUS_TYPE field of the ACMS$PROCESSING_STATUS workspace. In addition, ACMS uses the returned status code to retrieve a message from a message file. ACMS repeats the previous exchange, which should use a form that displays the retrieved error message.

Figure 3-11 GOTO STEP Clauses in a Nested Blocks Structure

# IF THEN ELSE Clause (Block, Exchange, Processing, Action)

> Takes actions based on values that you test with Boolean expressions.

> You can use an IF THEN ELSE clause to start a block, exchange, or processing step (thereby creating a conditional block, exchange, or processing step), or to start an action clause (thereby creating a conditional action clause).

> The IF THEN ELSE clause uses Boolean expressions to compare workspace fields and takes actions based on the results of the expressions. If the expression evaluates to true, ACMS performs the work or action associated with the THEN keyword. If the expression evaluates to false, ACMS performs the work or action associated with the ELSE keyword.

## Format

> - IF (boolean-expression)
> - THEN <clause>
> - [ ELSE <clause> ]
> - END IF;

## Parameters

> ### boolean-expression

> The Boolean expression must be an expression that ACMS can evaluate as either true or false. You must enclose Boolean expressions in parentheses. See Section 3.10 for a description of Boolean expressions.

> ### clause

> One of the following, depending on where you place the IF THEN ELSE clause:

> `block`

> The start of a nested block with the keywords BLOCK WORK, or the start of an exchange or processing step with the keywords EXCHANGE WORK and PROCESSING WORK, respectively. When you use the IF THEN ELSE clause at the block step level, you can specify multiple block, exchange, and processing steps for each Boolean expression or ELSE you list.

> At the block step level, you can use the IF THEN ELSE clause only at the top of the block; you cannot use it between steps within the block.

> `exchange-clause`

> Any unconditional exchange clause that is compatible with the I/O method that the block step uses. For example, if a block step uses FORM I/O, exchange steps in that block step can use one of the DECforms clauses (SEND, RECEIVE, or TRANSCEIVE) or NO EXCHANGE, but cannot use a TDMS clause (READ, WRITE, or REQUEST). There can be only one exchange clause for each Boolean expression or ELSE you list in the IF THEN ELSE clause.

> `processing-clause`

> Any unconditional processing clause. There can be only one processing clause for each Boolean expression or ELSE you list in the IF THEN ELSE clause.

> `action-clause`

> Any unconditional action clause. ACMS provides four types of unconditional action clauses: workspace manipulation, transaction action, server context, and sequencing. For each Boolean expression or ELSE you list in the IF THEN ELSE clause, you can specify one or both of the workspace manipulation clauses and one of each of the other three types of action clauses.

> You can use action clauses at the end of a block, exchange, or processing step.

Table 3_13 and Table 3-14 summarize the clauses that you can use within the IF THEN ELSE clause in each step.

Table 3-13 Clauses Compatible with the IF THEN ELSE Clause
At This Step | You Can Specify |  |
--- | --- | --- | ---
BLOCK | Multiple of: |  |
| BLOCK WORK EXCHANGE WORK PROCESSING WORK |  |
PROCESSING | One of: |  |
| CALL [PROCEDURE] CALL TASK DTR COMMAND DCL COMMAND IMAGE NO PROCESSING |  |
EXCHANGE | If task uses FORM I/O | If task uses REQUEST I/O | If task uses STREAM I/O
| One of: | One of: | One of:
| NO EXCHANGE RECEIVE SEND TRANSCEIVE | NO EXCHANGE READ REQUEST WRITE | NO EXCHANGE READ WRITE

Table 3-14 lists the action clauses you can use with the IF THEN ELSE clause.

Table 3-14 Action Clauses Compatible with the IF THEN ELSE Clause
For each Boolean expression or ELSE you list in the IF THEN ELSE clause, you can specify:
Workspace Actions | Transaction Actions | Server Context Actions | Sequencing Actions
--- | --- | --- | ---
Both: | One of: | One of: | One of:
MOVE GET ERROR MESSAGE | COMMIT TRANSACTION ROLLBACK TRANSACTION | NO SERVER CONTEXT ACTION RELEASE SERVER CONTEXT RETAIN SERVER CONTEXT | CANCEL TASK EXIT BLOCK EXIT TASK GOTO STEP RAISE EXCEPTION REPEAT STEP

## Keywords

> ### THEN

> Identifies the action to take if the Boolean expression evaluates to true.

> ### ELSE

> Optional keyword that identifies the action to take if the Boolean expression evaluates to false. If you do not specify ELSE and a corresponding clause, and the Boolean expression evaluates to false, control falls through to the next step. Refer to Table 7-1 for default recovery actions and Table 3-17 for default server context actions.

## Clause Default

> The IF THEN ELSE clause is optional. If you do not use the IF THEN ELSE clause or one of the other three conditional clauses, ACMS processes your exchange, processing, or action clauses unconditionally.

## Notes

> You must end each subclause in an IF THEN ELSE clause with a semicolon (;), and you must end the IF THEN ELSE clause with END IF and a semicolon (;).

> The ELSE keyword and a corresponding clause are optional. If you do not specify ELSE, and the expression evaluates to false, control falls through to the next step.

> The type of clause you can use within an IF THEN ELSE clause depends on the type of step that you are defining. For example, if you are using IF THEN ELSE to define an exchange step, you can only use exchange clauses.

> If you use IF THEN ELSE at the block step level, you can only use it at the top of the block. You cannot specify it between steps within the block.

## Block Clause Example

#1
    BLOCK WORK
        IF (HIRE_STATUS == "N")
        THEN
           EXCHANGE
              SEND FORM RECORD EMPLOYEE_INFO_RECORD
                 SENDING EMPLOYEE_INFO_WKSP;
        ELSE
           PROCESSING
              CALL EMPLOYEE_INFO_PROGRAM IN EMPLOYEE_INFO_SERVER
                 USING EMPLOYEE_INFO_WKSP_1;
              ACTION IS
                 EXIT TASK;
        END IF;
    END BLOCK;

> ACMS tests the contents of the HIRE_STATUS workspace field. If the Boolean expression evaluates to true, ACMS performs the exchange step associated with the THEN keyword. If the expression evaluates to false, ACMS performs the processing step associated with the ELSE keyword.

## Exchange Clause Example

#1
    EXCHANGE
        IF ((EMPLOYEE_CONTROL_KEY EQ "SKIP") OR
             (OLD_WORKSPACE == NEW_WORKSPACE))
        THEN
           NO EXCHANGE;
        ELSE
           SEND FORM RECORD EMPLOYEE_INFO_RECORD
                 SENDING EMPLOYEE_INFO_WKSP;
        END IF;

> ACMS tests the contents of EMPLOYEE_CONTROL_KEY, OLD_WORKSPACE, and NEW_WORKSPACE. If either Boolean operand in the expression evaluates to true, ACMS does not do any exchange work. If the Boolean expression evaluates to false, ACMS performs the SEND operation associated with the ELSE keyword.

## Processing Clause Example

#1
    PROCESSING
        IF (AGE_ENTERED >= 21)
        THEN
           CALL STANDARD_PROCESSING USING WAGE_HOUR_DATA;
        ELSE
           CALL YOUTH_PROCESSING USING WAGE_HOUR_DATA;
        END IF;

> This IF THEN ELSE clause tests the AGE_ENTERED workspace field; and, if the Boolean expression evaluates to true, ACMS performs the processing work associated with the THEN keyword. Otherwise, ACMS performs the processing work associated with the ELSE keyword.

## Action Clause Example

#1
    ACTION
        IF (EMPLOYEE_CONTROL_KEY EQ " FCAN")
        THEN
           CANCEL TASK;
        END IF;

> In this example, if the user presses the PF1 key to cancel the task, DECforms returns the value " FCAN" to the EMPLOYEE_CONTROL_KEY workspace field. If " FCAN" is in that field when ACMS processes the IF THEN ELSE clause, ACMS cancels the task. Because no ELSE subclause is specified, if the expression evaluates to false, ACMS passes control to the next step.

# IMAGE Clause (Processing)

> Names an OpenVMS image to do work for a processing step.

## Format

> IMAGE IS image-file-spec [ IN server-name ] ;

## Parameters

> ### image-file-spec

> The file specification of the OpenVMS image you want to run. A file specification is either an identifier or a quoted string pointing to the location of a file. The default file type is .EXE. The default device and directory are those defined for the server in the application definition.

> ### server-name

> The name of the server in which the image is executed. When you use the image clause, the server you name must be a DCL server. The server you name must be declared in the definition of the task group containing the task you are defining. If you do not name a server, ACMS uses the server named in the DEFAULT SERVER clause in the task part of the task definition.

## Clause Default

> If you do not use the IMAGE IS clause in a processing step definition, ACMS does not run an image in that step.

## Notes

> Any image you name must run in a DCL server.

> You can pass the contents of a selection string to an image in a processing step by using that string as a set of one or more parameters to the procedure call. The selection string provided by the terminal user can be separated by ACMS into parameters P1 through P8. Each parameter is delimited by a space or tab. At run time, ACMS converts any unquoted alphabetic characters to uppercase. To include spaces or tabs in a parameter or to keep a character in lowercase, the terminal user encloses the string with double quotation marks. To include a double quotation mark character in the string itself, the terminal user must enclose that character in double quotation marks. ACMS does not treat exclamation points or single quotation marks as special characters. Therefore, you do not have to enclose these characters in double quotation marks.

> The image can access these symbols by using the OpenVMS Run-Time Library routine that accesses Command Language Interpreter (CLI) symbols, LIB$GET_SYMBOL. See OpenVMS RTL Library (LIB$) Manual for more information.

> For more information on DCL command symbol substitution, see OpenVMS DCL Dictionary.

## Example

    DATR:
      PROCESSING
        IMAGE IS "SYS$SYSTEM:DTR32"
        IN COMMON_UTILITY_SERVER;

> The DATR task uses the server COMMON_UTILITY_SERVER to invoke the OpenVMS image DTR32.

# LOCAL Clause (Task)

> Specifies that a task can be called by or chained to another task, but not selected from a menu or called by an agent.

## Format

> LOCAL ;

## Clause Default

> The LOCAL clause is optional.

> If no LOCAL or GLOBAL clause is specified in a task definition, ACMS uses the default application definition LOCAL or GLOBAL attribute in effect when the application is built. If no LOCAL or GLOBAL attribute is specified in either the task definition or the application definition, a task is global by default and can be selected from a menu, called by an agent, or called by another task.

## Note

> A local task can call or chain to a global task or another local task.

## Example

    REPLACE TASK UPDATE_ACCOUNT
    LOCAL;
    PROCESSING WITH RMS RECOVERY
        IS
        CALL TRANSFER_FUNDS IN SECURE_SERVER;

> In this example, the task definition for UPDATE_ACCOUNT includes a LOCAL clause. Regardless of any LOCAL or GLOBAL task default in effect when an application using UPDATE_ACCOUNT is built, UPDATE_ACCOUNT is local and can be called only by another task.

# MOVE Clause (Action)

> Specifies that a number, the numeric value of a global symbol, a workspace field, or a quoted string, is to be moved into another workspace field or fields.

## Format

## Parameters

> ### signed-number

> A decimal number.

> ### global-symbol

> A valid global symbol that is resolved to a longword value from the files specified by the /USERLIBRARY, /OBJECT, /SYSLIB, or /SYSSHR qualifiers of a BUILD GROUP command.

> ### workspace-field

> A valid workspace field.

> ### quoted-string

> A character sequence that starts and ends with a double quote (") and contains a string of 1 to 255 characters.

## Note

> This clause requires the keyword INTO or TO. If the source is a global symbol, the data type of the target workspace field must be signed longword.

> You cannot move signed numbers to variables with data types other than longword.

> Although you can specify only one MOVE clause in the action part of a step, you can include multiple move operations within a single MOVE clause.

## Example

    ACTION IS
        MOVE 2 INTO WKSP.RECORD_NUMBER,
        RMS$_EOF TO WKSP.END_STATUS;

> This MOVE clause moves the signed number 2 into the workspace RECORD_NUMBER, and moves the global symbol RMS$_EOF into the workspace END_STATUS.

# NO EXCHANGE Clause (Exchange)

> Specifies that an exchange step does not do any work.

## Format

> NO EXCHANGE ;

## Clause Default

> The NO EXCHANGE clause is required if you do not want an exchange step to do any work. If you do not use the NO EXCHANGE clause, you must use one of the other exchange step clauses in an exchange step definition.

## Note

> You typically use the NO EXCHANGE clause if an exchange step uses a CONTROL FIELD, IF THEN ELSE, SELECT FIRST, or WHILE DO clause to do work conditionally. In addition, the NO EXCHANGE clause is useful as a documentation tool in a definition.

## Example

    EXCHANGE
      CONTROL FIELD PERS_RECORD.TEST_FIELD
        "Y"        : NO EXCHANGE;
        NOMATCH    : SEND FORM RECORD EMPLOYEE_INFO_RECORD;
      END CONTROL FIELD;

> ACMS tests TEST_FIELD in the PERS_RECORD workspace. If the value "Y" is in that field, ACMS does not process an exchange step. However, if any other value is in the field, ACMS processes the SEND operation.

# NO PROCESSING Clause (Processing)

> Specifies that the step does not do any processing work.

## Format

> NO PROCESSING ;

## Clause Default

> The NO PROCESSING clause is required if you do not want any processing performed in a processing step. If you do not use the NO PROCESSING clause, you must use one of the other processing clauses in a processing step definition.

## Notes

> You typically use the NO PROCESSING clause if a processing step uses a CONTROL FIELD, IF THEN ELSE, SELECT FIRST, or WHILE DO clause to do work conditionally. This clause is also useful as a documentation tool in a definition.

> If you use any RECOVERY phrase and the NO PROCESSING clause in the same processing step, ACMS cancels the task.

## Example

    CONTROL FIELD PERS_RECORD.TEST_FIELD
      "Y"       : NO PROCESSING;
      NOMATCH   : CALL ADD_EMPLOYEE IN PERSONNEL
                    USING WORKSPACE PERS_RECORD;
    END CONTROL FIELD;

> ACMS tests the field TEST_FIELD in the PERS_RECORD workspace. If the value of that field is "Y", ACMS does not execute a processing step and goes on to process the next step in the definition. However, if TEST_FIELD contains any other value, denoted by the NOMATCH keyword, ACMS processes the ADD_EMPLOYEE procedure.

Previous | Next | Contents | Index