Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ conditional_statements(1) — ACMSxp 3.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

statement(1)

stdl_syntax(1)

task_definition(1)

acmsxp_introduction(1)

conditional statements(1)  —  Commands

Digital

NAME

Conditional statements − control execution flow in a task based on test statement results
 

SYNOPSIS

CONTROL FIELD:
 
[<label-name>:] CONTROL FIELD <control-field>
                { CASE { <control-value>: | NOMATCH: } <statement> [ ... ]
                } [ ... ]
                END CONTROL FIELD [ <label-name> ] ;
 
IF THEN ELSE:
 
[<label-name>:] IF <boolean-expression>
                   THEN <statement> [ ... ]
                   [ ELSE <statement> [ ... ] ]
                END IF [ <label-name> ] ;
 
SELECT FIRST TRUE OF:
 
[<label-name>:] SELECT FIRST TRUE OF
                { CASE
                  { <boolean-expression>: | NOMATCH: } <statement> [ ... ]
                } [ ... ]
                END SELECT FIRST [ <label-name> ] ;
 
WHILE DO:
 
[<label-name>:] WHILE <boolean-expression>
                 DO <statement> [ ... ]
                END WHILE [ <label-name> ] ;

PARAMETERS

       •label-name
 
An internal unqualified identifier associated with a statement, for use in flow control operations.
 
The label name specified on the END statement must be the same as the label name associated with the CONTROL FIELD, IF, SELECT FIRST, or WHILE statement.

       •control-field
 
An integer workspace field, a text workspace field, or a decimal workspace field containing a value against which the control value is compared. The data type of each control value must match the data type of the control field.
 
If the CONTROL FIELD statement appears in a noncomposable task outside a transaction block, the control field cannot refer to a transactional workspace field. If the statement refers to any transactional workspace fields in a noncomposable task, enclose it within a transaction block.

       •control-value
 
The value to compare against the control field value. The control values are compared against the control field until a match is found. The data type of each control value must match the data type of the control field. Specify the control value as:
 
  Identifier-class or message
  Literal-decimal, integer, or string
  Workspace field-decimal, integer, or text
 
If the CONTROL FIELD statement appears in a noncomposable task outside a transaction block, the control value field cannot refer to a transactional workspace field. If the assignment statement refers to any transactional workspace fields in a noncomposable task, enclose it within a transaction block.

       •statement
 
A statement or statement list to execute, based on the result of the related evaluation.

       •Boolean-expression
 
A condition that produces a truth value when evaluated; the truth value can be either true or false. See the Boolean Expressions section in the SYNTAX RULES AND CONVENTIONS topic.
 
If a Boolean expression in an IF THEN ELSE, SELECT FIRST TRUE OF, or WHILE DO statement refers to any transactional workspace fields in a noncomposable task, the statement must be enclosed by a transaction block.

DESCRIPTION

The types of conditional statement are:

oCONTROL FIELD
 
Performs a statement or list of statements based on a condition. CONTROL FIELD names a control field in a workspace and control values for that field. The ACMSxp software executes the statement or list of statements associated with the first control value that matches the contents of the control field. Use NOMATCH to specify a statement to execute if no match occurs.
 

oIF THEN ELSE
 
Executes based on results of a Boolean condition test. If the Boolean expression evaluates to true, ACMSxp software executes the statement or list of statements associated with THEN. If the Boolean expression evaluates to false, ACMSxp software executes the statement or list of statements associated with ELSE.
 

oSELECT FIRST TRUE OF
 
Executes based on values that you test with Boolean expressions. If the expression evaluates to true, ACMSxp software executes the statement associated with that CASE. Use NOMATCH to specify a statement to execute if no match occurs.
 

oWHILE DO
 
Continuously performs work until a specified Boolean expression does not evaluate to true. If the expression evaluates to true, the ACMSxp software executes the statement associated with DO. If the expression evaluates to false, execution passes out of the WHILE DO statement.
 

CONTROL FIELD

 
If the CONTROL FIELD statement appears in a noncomposable task outside a transaction block, the control field and the control value cannot refer to a transactional workspace field.
 
Specify no more than one NOMATCH. If NOMATCH is specified, it must follow all other control values.
 
For CONTROL FIELD, the normal execution flow is:

     1.Sequentially compare the control field with each control value until each control value is compared or one control value matches the control field. 
 

     2.When a control value matches a control field, execute the set of statements associated with the control value. 
 

     3.If no control value matches a control field, execute the set of statements associated with NOMATCH. 
 

     4.Complete the CONTROL FIELD statement with default flow control. 

For CONTROL FIELD, deviations from the normal execution flow occur when:

oDuring the comparison of the control field and the control value, one of the conditions listed under the Exceptions section occurs; the CONTROL FIELD statement completes with the exception. 
 

oA statement completes with explicit flow control; the CONTROL FIELD statement completes with the same explicit flow control. 
 

oA set of statements completes with an exception; the CONTROL FIELD statement completes with the same exception. 
 

IF THEN ELSE

 
If the IF THEN ELSE statement appears in a noncomposable task outside a transaction block, the Boolean expression cannot refer to a transactional workspace field.
 
For IF THEN ELSE, the normal execution flow is:

     1.Evaluate the Boolean expression. 
 

     2.If the Boolean expression evaluates true, execute the set of statements associated with the THEN. 
 

     3.If the Boolean expression evaluates false, execute the set of statements associated with the ELSE. 
 

     4.Complete the IF statement with default flow control. 

For IF THEN ELSE, deviations from the normal flow occur when:

oDuring evaluation of a Boolean expression, one of the conditions listed under the Exceptions section occurs; the IF statement completes with the exception. 
 

oA set of statements completes with explicit flow control; the IF statement completes with the same explicit flow control. 
 

oA set of statements completes with an exception; the IF statement completes with the same exception. 
 

SELECT FIRST TRUE

 
If the SELECT FIRST TRUE statement appears in a noncomposable task outside a transaction block, the Boolean expression cannot refer to a transactional workspace field.
 
Specify no more than one NOMATCH. If NOMATCH is specified, it must follow all other Boolean expressions.
 
For SELECT FIRST TRUE, the normal execution flow is:

     1.Sequentially evaluate the Boolean expressions until one evaluates true or until they are all evaluated. 
 

     2.If a Boolean expression evaluates true, execute the set of statements associated with the Boolean expression. 
 

     3.If no Boolean expression evaluates true, execute the set of statements associated with NOMATCH. 
 

     4.Complete the SELECT FIRST TRUE statement with default flow control. 

For SELECT FIRST TRUE, deviations from the normal execution occur when:

oDuring evaluation of a Boolean expression, one of the conditions listed under the Exceptions section occurs; the SELECT FIRST TRUE statement completes with the exception. 
 

oA statement completes with explicit flow control; the SELECT FIRST TRUE statement completes with the same explicit flow control. 
 

oA set of statements completes with an exception; the SELECT FIRST TRUE statement completes with the same exception. 

WHILE DO

 
If the WHILE DO statement appears in a noncomposable task outside a transaction block, the Boolean expression cannot refer to a transactional workspace field.
 
For WHILE DO, the normal execution flow is:

     1.Evaluate the Boolean expression. 
 

     2.If the Boolean expression evaluates true, execute the statement or set of statements and execute the WHILE DO statement again. 
 

     3.If the Boolean expression evaluates false, complete the WHILE DO statement with default flow control. 

For WHILE DO, deviations from normal flow occur when:

oDuring evaluation of a Boolean expression, one of the conditions listed under the Exceptions section occurs; the WHILE DO statement completes with the exception. 
 

oThe set of statements completes with explicit flow control; the WHILE DO statement completes with the same explicit flow control. 
 

oThe set of statements completes with an exception; the WHILE DO statement completes with the same exception. 

EXCEPTIONS

 
Conditional statements can generate the AP-EXECUTION-FAULT exception class. This exception class generated by conditional statements indicates one of the following error conditions:

oThe subscript used to refer to an element in a fixed-length array is invalid (referring to A(n) where n is less than one or n is greater than the maximum size of array). 
 

oThe subscript used to refer to an element in a variable-length array is invalid (referring to A(n) where n is less than one or n is greater than the value of the DEPENDING ON field). 
 

oThe value of the DEPENDING ON field used when referring to an element of a variable-length array is invalid (the value of the DEPENDING ON field is less than the minimum size of the array or the value of the DEPENDING ON field is greater than the maximum size of array). 
 

oThe value of the DEPENDING ON field was invalid when referring to a workspace name or workspace field containing a variable-length array. 
 

RELATED INFORMATION

Syntax: statement(1), stdl_syntax(1), task_definition(1)

acmsxp_introduction(1)
 
 

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