Logical Expressions
ENFORM Language Elements
058057 Tandem Computers Incorporated
3–27
BEGINS WITH and
CONTAINS
BEGINS WITH and CONTAINS are special conditional operators that can be used to
yield a true or false value if a field either begins with or contains a specific
alphanumeric string.
The BEGINS WITH operator determines if a field starts with a specified alphanumeric
string. For example, the following can be used to limit the data retrieved from the
supplier field to only those records whose suppname field begins with TANDEM:
LIST supplier WHERE suppname BEGINS WITH "TANDEM",
In this example, the logical expression is evaluated as true only if the field begins with
a value where TANDEM is in uppercase characters.
The BEGINS WITH operator can only be used with fields specified as alphanumeric in
the data dictionary. A field is alphanumeric when its corresponding data description
entry is specified as PIC X.
The CONTAINS operator determines if a field contains a specified alphanumeric
string. For example, the following determines whether the empname field contains
the value GEORGE:
empname CONTAINS "GEORGE"
ENFORM does not support variable-length parameters. The following query, in
which xyz has been defined as a five-character field, will not work if you pass xyz a
three-character value:
PARAM xyz INTERNAL A5;
OPEN order;
LIST order WHERE KEY BEGINS WITH "xyz";
ENFORM will look for a value of “xyz” plus two blanks, and the query will fail.
Range of Values in Logical
Expressions
A field can be compared to a range of values in a logical expression. In the range,
value-1 must be less than value-2. Values used in a range can be either numeric
literals or string literals.
Specifying field EQ value1 THRU value2 is equivalent to specifying:
field-name GE value-1 AND field-name LE value-2
A range can contain a numeric literal if the field being examined is defined as numeric
in the data dictionary. The inventory field of the parts file is defined as PIC 999. The
following logical expression is evaluated as true if the value of the inventory field falls
within the range of 5 to 15, including the values 5 and 15:
inventory EQ 5 THRU 15,
Summary of Contents for ENFORM 058057
Page 6: ...New and Changed Information 058057 Tandem Computers Incorporated v...
Page 18: ...Preface xvi 058057 Tandem Computers Incorporated This page left intentionally blank...
Page 19: ...Preface 058057 Tandem Computers Incorporated xvii...
Page 269: ...Glossary Glossary 4 058057 Tandem Computers Incorporated This page left intentionally blank...