Compaq AAQ2G1FTK Marine Radio User Manual


 
Handling Numeric Data
2.4 Invalid Values in Numeric Items
both the /CHECK=DECIMAL and the /CONVERT qualifiers on OpenVMS Alpha,
the conversion of blanks will be done prior to the validation of the resulting
numeric digits. Note that the use of either or both of these qualifiers increases
the execution time of the program. See Compaq COBOL online Help (at the
OpenVMS Alpha system prompt), or
man cobol
(on Tru64 UNIX) for more
information.
2.5 Evaluating Numeric Items
Compaq COBOL provides several kinds of conditional expressions used for
evaluating numeric items. These conditional expressions include the following:
The numeric relation condition that compares the item’s contents to another
numeric value
The sign condition that examines the item’s sign to see if it is positive or
negative
The class condition that inspects the item’s digit positions for valid numeric
characters
The success/failure condition that checks the return status codes of COBOL
and non-COBOL procedures for success or failure conditions
The following sections explain these conditional expressions in detail.
2.5.1 Numeric Relation Test
A numeric relation test compares two numeric quantities and determines if the
specified relation between them is true. For example, the following statement
compares item FIELD1 to item FIELD2 and determines if the numeric value of
FIELD1 is greater than the numeric value of FIELD2:
IF FIELD1 > FIELD2 ...
If the relation condition is true, the program control takes the true path of the
statement.
Table 2–1 describes the relational operators.
Table 2–1 Numeric Relational Operator Descriptions
Operator Description
IS [NOT] GREATER THAN
IS [NOT] >
The first operand is greater than (or not greater
than) the second operand.
IS [NOT] LESS THAN
IS [NOT] <
The first operand is less than (or not less than)
the second operand.
IS [NOT] EQUAL TO
IS [NOT] =
The first operand is equal to (or not equal to) the
second operand.
IS GREATER THAN OR
EQUAL TO
IS >=
The first operand is greater than or equal to the
second operand.
IS LESS THAN OR EQUAL TO
IS <=
The first operand is less than or equal to the
second operand.
Comparison of two numeric operands is valid regardless of their USAGE clauses.
Handling Numeric Data 2–3