The vgLib.compareStr() system function compares two substrings according to their ASCII or EBCDIC order at run time.
vgLib.compareStr() is one of a number of functions maintained for compatibility with earlier versions. New code can use standard EGL operators for these purposes.
EGL performs a byte-to-byte comparison of the values. If the values are not the same length, EGL pads the shorter value with blanks, even that if value is numeric.
vgLib.compareStr(
var1 CharType in,
var1SubstrIndex INT in,
var1SubstrLength INT in,
var2 CharType in,
var2SubstrIndex INT in,
var2SubstrLength INT in )
returns (result INT)
The following example illustrates the use of the vgLib.compareStr() function.
target, source CHAR (6);
result INT;
target = "123456";
source = "34";
result = vgLib.compareStr(target,3,2,source,1,2); // result = 0
| Platform | Issue |
|---|---|
| COBOL generation | NUM is a legal type for the source or target variable |