SINGLE VALUE COMPARISONS [ HP Data Entry and Forms Management System (VPLUS/V) ] MPE/iX 5.0 Documentation
HP Data Entry and Forms Management System (VPLUS/V)
SINGLE VALUE COMPARISONS
Used to compare the field value against a single value.
Syntax
{GT}
{LT}
{GE}
{LE} value ["message"]
{EQ}
{NE}
Parameters
value The value can be a field, constant, save field, or a
numeric expression, or it may be an index retrieve
operand within parentheses. Refer to "Statement Syntax"
earlier in this section for details.
message Specifies a custom error message.
Discussion
You may use these statements to compare the contents of the current field
with a specified value. Any field can be compared to the special
comparison value $EMPTY that represents the lowest value for any data
type. The main rule governing these comparisons is that only values of
the same data type (character, numeric, or date) may be compared. The
comparison is performed from left to right after leading and trailing
blanks have been stripped from the field.
Character Comparisons
If the two values being compared are not the same length, the shorter is
padded with blanks on the right until it is the same length as the longer
value. Then the comparison is made.
In a character comparison, values are considered equal only if each
character matches. One value is less than another if, at the point of
mismatch, one character is numerically less than its counterpart.
Collating sequence order is used to determine the numeric value of a
character. (Refer to Appendix C for the USASCII collating sequence;
refer to the Language Support Reference Manual for the collating
sequences for all supported native languages.) For example, for
NATIVE-3000:
a is greater than A
A is greater than
AA is greater than A
A is greater than a
where represents a blank.
Numeric Comparisons
When numeric values are compared, they are first converted to the HP 3000
internal representation of the number. Thus, a field of type IMPn can be
compared with NUMn, and NUMn or IMPn fields can be compared to type DIG
fields. For example, assume a field of type NUM 2 in which the value 123
has been entered. This value can be successfully compared to the
constant "123", or a field of type IMP, NUM, or DIG so long as the field
contains the value 123 at run-time. For example:
123.000 (NUM3) is equal to 123 (DIG)
123.000 (NUM3) is equal to 12300 (IMP2)
Date Comparisons
Two dates may be compared even if they differ in format and order. This
means that the date February 9, 1986, specified in the current field as 9
FEB 1986 (DMY) can be successfully matched against the constant !
02/09/86! whose order is MDY. Remember: a date constant must always be
in the order MDY. For example:
2/3/86 (MDY) is equal to Feb 3, 1986 (MDY)
2/3/86 (MDY) is equal to 86/2/3 (YMD)
Example
EQ F3 The current field value must exactly match the value in
F3 at run time. (Any leading or trailing blanks are
stripped from the value in both fields before the
comparison is made.)
GT 143.56 The current field value must be greater than 143.56
NE $TODAY A date entered in this field cannot be today's date.
GT "Cd" The current field may contain any value greater than Cd,
such as D or Cde but it cannot be C or CD. Note that in
NATIVE-3000 all uppercase characters have a lower value
than any lowercase character.
GE !5/7/86! Any date including and after May 7, 1986 may be in
current field. The date may be in any of three formats:
MDY, DMY, or YMD.
Native Language Support
NATIVE-3000 must be used to define values for date and numeric fields
within FORMSPEC. VPLUS/V will convert the value when the forms file is
executed to be consistent with the native language selected. Single
value comparisons (GT, GE, LT, LE, EQ, NE), specified within FORMSPEC may
contain any character in the 8-bit extended character set consistent with
the selected language ID. When the form is executed, the collating table
for the native language specified is used. For more information on
Native Language Support, see Section 8.
MPE/iX 5.0 Documentation