INCLUDE/OMIT Samples

If you want to include records in which the first four bytes are greater than 1000 when interpreted as USAGE DISPLAY data, you could use one of the following code statements:

include cond = 1 4 nu gt 1000

or

omit cond (1 4 nu le 1000)

To include records in which the first four bytes are the same as the second four bytes when interpreted as characters, you could use one of the following statements:

include cond = 1 4 ch eq 5 4 ch

or

omit cond 1 4 ch ne 5 4 ch

As another example, if you want to omit any record in which the first four bytes (COMP-6) are greater than the second four bytes (COMP-4), you could use one of the following statements (note the use of the FORMAT phrase in this example):

omit format=c6 cond = (1 4 gt 5 4 bi)

or

include cond 1 4 c6 le 5 4 format bi

In addition to the data types already available with SORT/MERGE, the INCLUDE/OMIT instructions may have a substring search (SS) type, which indicates that a search should be performed for the specified character constant. Only the equal to (EQ) or not equal to (NE) operators may be used in conjunction with the SS type. The designated string is either found or not found with this comparison. As an example, each of the following code statements would result in the omission of records in which the first 10 characters contain the substring "data":

omit cond 1 10 ss eq c'data'

or

include cond = (1 10 ss ne c'data')

Constant types can be decimal, hexadecimal, or character. Decimal constants match the pattern

[+-]?[0-9]+  

that is, an optional sign character followed by a number of digits. Decimal constants may be up to 76 digits long.

Hexadecimal constants match the pattern

x'([0-9A-F]{2})+' 

that is, a leading x indicating a hex constant and then groups of two hexadecimal digits in single quotation marks. Hexadecimal constants are unsigned and may be up to 64 hexadecimal digits long (32 bytes). For example, either of the following statements results in the inclusion of records in which the first 10 characters (USAGE DISPLAY) equal 0xFFFF:

include cond = (1 10 nu eq x'FFFF')

or

omit cond 1 10 nu ne x'FFFF'

Character constants match the pattern

c'.+' 

that is, a leading c indicating a character constant and then a number of characters in single quotation marks. Single quotation marks may be represented within the character constant by specifying two single quotation marks in a row.

In general, numeric types may be compared against each other or against a constant. Floating point data may only be compared against other floating point data. Strings may be compared against each other, a string, or a hexadecimal constant. Strings may also be used in substring searches.

Specifically, data types BI, C5, C6, CX, LI, LS, NU, PD, S5, SB, TI, and TS may be compared against each other, or against a hexadecimal or decimal constant. BI and CH may be compared against each other or a string constant. CH may be compared against a hexadecimal constant.

The AND and OR operators may be used to join comparison expressions. The AND operator takes precedence over OR. Note that the characters "&" and "|" may be used to represent AND and OR, respectively. As an example, either of the following statements results in the omission of any record in which the first character does not equal the second or the third character:

omit cond = (1 1 ne 2 1) & (1 1 ne 3 1) format ch

or

include format=ch cond ((1 1 eq 2 1) or (1 1 eq 3 1))

Parentheses may be used to determine the evaluation order of an expression. An expression is evaluated only as far as necessary to determine the inclusion or exclusion of the record. For example, if a conditional is a list of expressions joined by AND operators, and the first expression evaluates as false, the remainder of the expressions is not evaluated for this record.