Sets the current value of the ONGSOURCE built-in function.
ONGSOURCE() = string
or
ONGSOURCE = string
The second syntax form can be used only when ONGSOURCE has been explicitly declared using the BUILTIN attribute.
This example assumes Codepage of 932 - SHIFT-JIS - Japanese.
ONGSRC: PROC OPTIONS(MAIN); DCL I FIXED BIN(15); DCL CSTR CHAR(4); DCL GSTR GRAPHIC(4); ON CONVERSION BEGIN; PUT SKIP LIST("ON CONVERSION TRIGGERED"); ONGSOURCE() = 'Err!'; i = 99; END ; GSTR = '8989826182638264'GX; /* x8989 invalid dbcs char */ PUT SKIP LIST(HEX(GSTR)); CSTR = GSTR; /* '8989'gx conversion error */ PUT SKIP LIST(HEX(GSTR)); CSTR = GSTR; PUT SKIP LIST(CSTR); END;
Will print:
8989826182638264 ON CONVERSION TRIGGERED 8989826182638264 ON CONVERSION TRIGGERED Err!
None.
Description
The ONGSOURCE 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 ONGSOURCE pseudovariable is valid only in the context of a CONVERSION ON-unit. In all other cases, the ONGSOURCE pseudovariable is ignored.