Comparison Expression
Used to compare two values or to compare two character strings to determine if the first string matches or contains the second string.
idmscu19
Used to compare two values or to compare two character strings to determine if the first string matches or contains the second string.
Syntax
►►─┬─┬─comparison-value──────┬──operator──┬─comparison-value──────┬─┬───►◄ │ └─arithmetic-expression─┘ └─arithmetic-expression─┘ │ │ │ └─comparison-value─┬─ CONTAINS ─┬─comparison-value─────────────────┘ └─ MATCHES ──┘Expansion of Comparison-Value►►─┬─literal──────────────────────────────────────────────────────────┬─────►◄ ├─data-field-name-variable─────────────────────────────────────────┤ └─lr-field-name─┬────────────┬─┬───────────────────────┬─┬───────┬─┘ └ OFlr-name┘ │ ┌─────────────┐ │ └ OF LR ┘ └ ( ─▼─subscript─┴─ ) ┘
Parameters
- comparison-valueSpecifies the value to be compared.Expanded syntax forcomparison-valueis shown above immediately following the compression expression syntax.
- arithmetic-expressionSpecifies an arithmetic expression, according to the rules presented in Arithmetic Expressions.
- operatorThe comparison operators are:
Operator
| Synonym
| Meaning
|
EQ | = | Equal |
NE | Not equal to | |
GT | > | Greater than |
LT | < | Less than |
GE | Greater than or equal to | |
LE | Less than or equal to |
- CONTAINSSearches the left operand for an occurrence of the right operand.The length of the right operand must be less than or equal to the length of the left operand, and both operands must be EBCDIC or unsigned zoned decimal data types. If the right operand is not entirely contained in the left operand, the outcome of the comparison is false.
- MATCHESCompares the left operand to the right operand, one character at a time, beginning with the leftmost character in each operand. The right operand can contain mask characters, as follows:
- @-- Matches any alphabetic character
- #-- Matches any numeric character
- *-- Matches any character
Expansion of Comparison-Value
- literalA user-supplied variable, expressed as a numeric constant, or the character string itself, enclosed in single quotation marks.
- data-field-name-variableSpecifies the name of a variable data field, according to the rules presented in Variable Data Fields.
- lr-field-nameSpecifies the name of a field in a Logical Record Facility record known to the subschema associated with the dialog.
- OFlr-nameSpecifies the name of the record that contains the field referenced bylr-field-name.This clause is required only if the named field is not unique among the records known to the dialog.
- subscriptSpecifies the applicable occurrence of the field referenced bylr-field-name. This can be a variable field containing the applicable occurrence, the occurrence itself, or an expression.This clause applies only if the named field is defined as a multiply-occurring field.
- OF LRSpecifies that the value of the named field at the time that the request is issued is used throughout processing of the request.If the value of the field changes during processing, LRF continues to use the original value. If OF LR is not specified and the value of the field changes during processing of the request, the new value in the dialog's record buffer is used for any further processing of the request.
Usage
Considerations
Both the left and right operands must be EBCDIC or unsigned zoned decimal data types. The length of the string that is compared is set to the length of the shorter of the two operands. If a character in the left operand does not match the corresponding character in the right operand, the outcome of the comparison is false.