How to: |
The CHKPCK function validates the data in a field described as packed-decimal format (if available on your platform). The function prevents a data exception from occurring when a request reads a field that is expected to contain a valid packed number but does not.
To use CHKPCK:
CHKPCK(length, in_value, error, output_format)
where:
Numeric
Is the number of bytes in the packed-decimal field. The length can be between 1 and 16 bytes.
Alphanumeric
Is the value to be verified as packed decimal. The in_value is intentionally described as alphanumeric, not packed.
Numeric
Is the error code that the function returns if a value is not in packed-decimal format. Choose an error code outside the range of data. The error code is first truncated to an integer, then converted to packed format. However, it may appear on a report with a decimal point because of the format of the output field.
Packed-decimal
CHKPCK validates the values in PACK_SAL, and store the result in a column with the format P8CM. Values not in packed format return the error code -999. Values in packed format appear accurately.
CHKPCK(8, PACK_SAL, -999, 'P8CM')
iWay Software |