How to: |
TO_INTEGER converts a character string that contains a valid number consisting of digits and an optional decimal point to an integer value. If the value contains a decimal point, the value after the decimal point is truncated. If the value does not represent a valid number, zero (0) is returned.
TO_INTEGER(string)
where:
Is a character string enclosed in single quotation marks or a character field that represents a number containing digits and an optional decimal point.
The following request converts character strings to integers. Digits following the decimal point are truncated.
DEFINE FILE WF_RETAIL_LITE INT1/I8 = TO_INTEGER('56.78'); INT2/I8 = TO_INTEGER('.5678'); INT3/I8 = TO_INTEGER('5678'); END TABLE FILE WF_RETAIL_LITE PRINT INT1 INT2 INT3 BY BUSINESS_REGION AS Region WHERE READLIMIT EQ 1 ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The output is shown in the following image.