Rocket® Enterprise Developer (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.
Assignment - ONCHAR Pseudovariable
Purpose
Sets the current value of the ONCHAR built-in function.
Syntax
ONCHAR() = string
or
ONCHAR = string
The second syntax form can be used only when ONCHAR has been explicitly declared using the BUILTIN attribute.
Parameters
- string
- An expression that is converted to a character string of length 1.
Example
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.
Restrictions
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.