IF command

From m204wiki
Revision as of 01:05, 28 February 2013 by Alex (talk | contribs) (Automatically generated page update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Privileges
Any user
Function
Executes a procedure if a condition is satisfied

Syntax

IF global-variable=value, {procnumber | procname} [delimiter response [delimiter response...]]

Where:

global-variable is the name of the global variable whose value is to be tested.
value is the value for which the global variable is to be tested. If this value matches the value of the global variable, the specified procedure is executed (INCLUDEd).
procnumber is the number of an existing temporary procedure. It can be zero or a negative number.
procname is the name of an existing procedure.
delimiter is one of the following characters:
Character name Keyboard display
Blank
Comma ( , )
Equal sign ( = )
Left parenthesis ( ( )
Right parenthesis ( ) )
response is a dummy string or $READ function response. Any number of responses can be specified on a command line, separated by delimiters.

Syntax notes

If dummy string and $READ responses are specified on the same command line, dummy string responses must appear first.

Example

PROCEDURE REPORT BEGIN . . . END IF REPORTNO = 1, REPA,YES,NO IF REPORTNO = 2, REPB IF REPORTNO = 3, REPC END PROCEDURE

Usage notes

The IF command conditionally executes a procedure or a recent User Language request. The INCLUDE command unconditionally executes a procedure. (The presentation of the INCLUDE command describes procedure execution.) If the value specified in the command matches the value of the specified global variable, Model 204 executes the procedure.

As dummy strings and $READ functions are encountered in the procedure, responses are retrieved, one by one, from the responses specified in the IF command, as shown in the example.

The Model 204 User Language Manual discusses dummy strings and the $READ function in detail.