Statements That Affect T/F Status Indicators


There are a number of statements that affect the value of internal true/false status indicators. Of the seven functional categories of statements shown in Table 4-1-1, only the following affect these indicators:

·    Two field-related statements set the next status indicator to T or F: RECEIVE (depending on whether or not there is a matching PASS statement) and VERIFY (depending on whether or not the VERIFY operation is successful).

·    Two types of control statements:

·    The process-type statements (CALL, INPUT, RUN, etc.) alter the flow of processing and invoke a specified process. The specified process is either invoked successfully (sets a value of T) or fails (sets a value of F)

·    The GOSUB and RETURN statements store the current indicator values, clear the values for independent use within the GOSUB subroutine, and then restore the indicators to their original values for continued processing following the RETURN. In addition, when implemented, GOSUB will set the next status indicator to the value indicated in the RETURN statement, if any.

·    All condition-testing statements (IF, AND, and OR) test the relationship between two values. The result is always either true or false, and the indicator is set or modified accordingly.

·    Only one image-related statement sets the next status indicator to T or F: AT FIELD (depending on whether or not the cursor is positioned on the field or fields specified).

·    Several file-related statements (CREATE, READ, WRITE, etc.) set a value of T if successful, or F if not.

All statements affecting T/F values are listed in alphabetical order in Table 4-2-1 below:

Statement

Condition

AND

If the AND statement is evaluated as false, APPX changes the current value of the next status indicator to F; otherwise, it preserves the current value. Refer to the Using AND and OR Statements section.

AT FIELD

If the cursor is positioned on the specified field or fields, APPX sets the value of the next status indicator to T, otherwise, to F. See the AT FIELD keyword for further options.

CALL

If the called routine is invoked successfully, APPX sets the next status indicator to T; otherwise, to F.

CNV PORT

If the conversion is successful, APPX sets the next status indicator to T; otherwise, to F.

CNV TEXT

If the conversion is successful, APPX sets the next status indicator to T; otherwise, to F.

CREATE

If the file creation executes successfully, APPX sets the next indicator to T; otherwise, to F.

GOSUB

When a GOSUB statement executes, APPX stores the current status indicators, then clears them to give the subroutine a clean slate for setting values as required. The indicators are restored to their original values for continued processing following the RETURN. In addition, when implemented, GOSUB will set the next status indicator to the value indicated in the RETURN statement, if any.

IF

If the IF statement is evaluated as true, APPX sets the next level to T; otherwise, to F.

IF DIFF

If the IF DIFF statement is evaluated as true, APPX sets the next level to T; otherwise, to F.

IF EXIST

If the specified file exists, APPX sets the next level to T; otherwise, to F.

INPUT

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

INQUIRY

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

JOB

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

MENU

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

OPEN

If the file is opened successfully, APPX sets the next level to T; otherwise, to F. An OPEN succeeds unless the file does not exist, the file was already open for exclusive use, or there is a file authorization failure.

OR

If the OR statement is evaluated as true, APPX changes the current value of the next status indicator to T; otherwise, it preserves the current value. Refer to the Using AND and OR Statements section.

OUTPUT

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

QUERY

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

READ

If the file READ operation is successful, APPX sets the next level to T; otherwise, to F. A READ is successful unless a specified record is not in the file.

READNEXT

If the READNEXT operation is successful, APPX sets the next level to T; otherwise, to F. A READNEXT is successful unless an end-of-file condition is encountered, or no record is found within the range specified by previous BEG AT and/or END AT statements.

RECEIVE

If the named field is passed explicitly via a PASS statement, APPX sets the next indicator to T; otherwise, to F.

RETURN

A RETURN statement has a special effect on true/false status indicators. You use a RETURN statement as the last step in a GOSUB routine to return control to the original point in an ILF routine where a GOSUB was invoked. When a RETURN statement executes, APPX automatically resets all five indicators to the values that existed just before the GOSUB operation was invoked. In addition, when implemented, GOSUB will set the next status indicator to the value indicated in the RETURN statement, if any.

REWRITE

If the REWRITE operation is successful, APPX sets the next level to T; otherwise, to F. A REWRITE is successful unless the record was not previously held for update, or it contains a duplicate key on a key path where duplicates are not allowed.

RUN

If the external program is invoked successfully, APPX sets the next status indicator to T; otherwise, to F.

SCRATCH

If APPX successfully scratches (deletes) a specified file or the file does not exist, APPX sets the next level to T; otherwise, to F.

STATUS

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

SUBR

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

UPDATE

If the specified process completes successfully, APPX sets the value of the next status indicator to T; otherwise, to F.

VERIFY

If the VERIFY operation is successful, APPX sets the next status indicator to T; otherwise, to F.

WRITE

If the record is written successfully, APPX sets the next status indicator to T; otherwise, to F.

Table 4-2-1. Statements That Affect Internal True/False Status Indicators