Use the @
HIGHVAL
and @LOWVAL
functions when you need to generate a value, but you want to constrain it within an upper or lower limit. These functions emulate the COBOL functions of the same name.
Use @HIGHVAL
and @LOWVAL
only with string and binary data types. Using them with decimal or date data types, or with SQLEXEC, can cause errors.
Note:
Invalid maps to incorrect type will result in a mapping error 222.
Syntax
@HIGHVAL ([length]) | @LOWVAL ([length])
Examples
This example sets COBOL-type group level to low values if key is less than 50
, and it sets COBOL-type group level to high values if the key is greater than 50
.
MAP \PROD.$DATA.MASTER.CUSTOMER, TARGET \BACK.$DATA.MASTER.CUSTOMER, DEF CUSTOMER-REC, TARGETDEF NEW_CUSTOMER_REC, COLMAP (USEDEFAULTS, CUST-KEY = CUST-KEY, GROUP-LEVEL = @IF (CUST-KEY < 50,@LOWVAL(), @HIGHVAL()));
The following example assumes that the size of the GROUP-LEVEL
field is 5 bytes.
Function statement | Results |
---|---|
GROUP-LEVEL = @HIGHVAL () |
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF} |
GROUP-LEVEL = @LOWVAL () |
{0x00, 0x00, 0x00, 0x00, 0x00} |
GROUP-LEVEL = @HIGHVAL (3) |
{0xFF, 0xFF, 0xFF} |
GROUP-LEVEL = @LOWVAL (3) |
{0x00, 0x00, 0x00} |