Returns a wide character string whose value is the context of the field that was being processed when the CONVERSION condition was signaled.
ONWSOURCE()
or
ONWSOURCE
The second syntax form can be used only when ONWSOURCE has been explicitly declared with the BUILTIN attribute.
ONWSRC: PROC OPTIONS(MAIN); DCL I FIXED BIN(15); DCL CSTR CHAR(4); DCL WSTR WCHAR(4); ON CONVERSION BEGIN; DCL BADSTR WCHAR(4); PUT SKIP LIST("ON CONVERSION TRIGGERED"); BADSTR = ONWSOURCE(); PUT SKIP LIST (HEX(BADSTR)); END ; WSTR = '9941004200430044'WX; PUT SKIP LIST(HEX(WSTR)); CSTR = WSTR; /* '9941'wx conversion error */ PUT SKIP LIST(CSTR); END;
Will print:
9941004200430044 ON CONVERSION TRIGGERED 9941004200430044
None.
Description
The ONWSOURCE function returns a wide character string whose value is the context of the field that was being processed when the CONVERSION condition was signaled.
The ONWSOURCE function can be used in an ON-unit established for a CONVERSION condition. It can also be used for an ERROR ON-unit that obtains control as the result of unsuccessful error correction in the CONVERSION ON-unit.
The returned value is a varying-length wide character string.