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 - ONSOURCE Pseudovariable
Purpose
Sets the current value of the ONSOURCE built-in function.
Syntax
ONSOURCE() = string
or
ONSOURCE = string
The second syntax form can be used only when ONSOURCE has been explicitly declared using the BUILTIN attribute.
Parameters
- string
- An expression that is converted to a character string. If the length of the field that caused the CONVERSION condition is greater than the length of string, string is padded with blanks. If the length of the field is less than the length of string, string is truncated to match the field length.
Example:
DCL I FIXED BIN(15); ON CONVERSION BEGIN; ONSOURCE() = '0'; END; I = STRING VALUE; PUT LIST(I);
If STRING_VALUE contains an invalid character, use of the ONSOURCE pseudovariable in the above example resets STRING_VALUE to zero. Therefore, the program will display an integer value of 0.
Restrictions
None.
Description
The ONSOURCE pseudovariable is used to replace the invalid string that caused the CONVERSION condition to be raised. This new string is used when the conversion is attempted again.
The ONSOURCE pseudovariable is valid only in the context of a CONVERSION ON-unit. In all other cases, the ONSOURCE pseudovariable is ignored.