Character-string to arithmetic conversion converts a character string to any arithmetic data type.
If the context that caused the conversion does not give a target base or scale, fixed or decimal is supplied by default. If it does not supply a target precision, the maximum precision allowed by the implementation for the target base and scale is supplied. For the maximum precision allowed by Open PL/I, see your Open PL/I User's Guide.
If the source character-string value is a null string or if it contains all blanks, the value of the result is zero; otherwise, the source string must contain a valid optionally signed constant surrounded by optional blanks. The constant is converted to conform to the data type of the target using the normal rules for arithmetic to arithmetic conversion.
| Source | Result |
|---|---|
![]() |
5 |
| -7 | |
| 0 |
The results in the previous example would be produced by converting a Character(6) source value to a fixed-point integer result value.