A condition
compares a range of bytes or a field from the record against a constant string. The source of the comparison can be either a field in the record or a byte range in the record. The comparison is done on a byte-by-byte basis. If a string is specified as the target of the comparison, then it will be translated into the character set of the data file. If the field has a noncharacter data type, then no data type conversion is performed on either the field value or the string. The syntax for a condition
is as follows:
This clause describes a range of bytes or characters in the record to use for a condition. The value used for the STRING SIZES ARE
clause determines whether range
refers to bytes or characters. The range
start
and range
end
are byte or character offsets into the record. The range
start
must be less than or equal to the range
end
. Finding ranges of characters is faster for data in fixed-width character sets than it is for data in varying-width character sets. If the range refers to parts of the record that do not exist, then the record is rejected when an attempt is made to reference the range. The range start:range end
must be enclosed in parentheses. For example, (10:13).
The data file should not mix binary data (including data types with binary counts, such as VARCHAR
) and character data that is in a varying-width character set or more than one byte wide. In these cases, the access driver may not find the correct start for the field, because it treats the binary data as character data when trying to find the start.
The following are some examples of using condition
:
LOAD WHEN empid != BLANKS LOAD WHEN (10:13) = 0x'00000830' LOAD WHEN PRODUCT_COUNT = "MISSING"