Sets the current value of the ONCHAR built-in function.
ONCHAR() = string
or
ONCHAR = string
The second syntax form can be used only when ONCHAR has been explicitly declared using the BUILTIN attribute.
DCL I FIXED BIN(15); ON CONVERSION BEGIN; ONCHAR() = '0'; END; I ='34Z9'; PUT LIST(I);
In the above example, an invalid character, 'Z,' is changed to '0'; therefore, the program will display an integer value of 3409.
None.
Description
The ONCHAR pseudovariable is used to replace the invalid character that caused the CONVERSION condition to be raised. This new character is used when the conversion is attempted again.
The ONCHAR pseudovariable is valid only in the context of a CONVERSION ON-unit. In all other cases the ONCHAR pseudovariable is ignored.