The
system function VGLib.compareBytes compares two
fields, byte by byte.
As is true in
StrLib.compareStr, the source and
target may be of a character type. In the current function, the
source also may be any of the following types:
- BIN (or the integer equivalents BIGINT, INT, and SMALLINT)
- DECIMAL
- NUM
- NUMC
- PACF
StrLib.compareBytes(
target a character type in,
targetIndex INT in,
targetSubLength INT in,
source BIN, DECIMAL, NUM, NUMC, PACF, or a character type in,
sourceIndex INT in,
sourceSubLength INT in )
returns (result INT)
- result
- Numeric field that receives one of the following values (defined as type
INT or the equivalent: type BIN with length 9 and no decimal places) returned
by the function:
- -1
- The value based on target is less than the value
based on source
- 0
- The value based on target is equal to the value
based on source
- 1
- The value based on target is greater than the
value based on source
- target
- Value from which a target value is derived. Can be a field or a literal.
- targetSubIndex
- Identifies the starting byte of a value in target,
given that the first byte in target has the index
value 1. This index can be an integer literal. Alternatively, this index can
be a field defined as type INT or the following equivalent: type BIN with
length 9 and no decimal places.
- targetSubLength
- Identifies the number of bytes in the value that is derived from target.
The length can be an integer literal. Alternatively, the field can be defined
as type INT or the following equivalent: type BIN with length 9 and no decimal
places.
- source
- Field or literal from which a source value is derived.
- sourceSubIndex
- Identifies the starting byte of the value in source,
given that the first byte in source has the index
value of 1. This index can be an integer literal. Alternatively, this index
can be a field defined as type INT or the following equivalent: type BIN with
length 9 and no decimal places.
- sourceSubLength
- Identifies the number of bytes in the value that is derived from source.
The length can be an integer literal. Alternatively, this index can be a field
defined as type INT or the following equivalent: type BIN with length 9 and
no decimal places.
A byte-to-byte comparison of the values is performed. If the values are
not the same length, the shorter value is padded with blanks even that value
is numeric.