ONSOURCE Function

Purpose

Returns a character string whose value is the context of the field that was being processed when the CONVERSION condition was signaled.

Syntax

ONSOURCE()

or

ONSOURCE

The second syntax form can be used only when ONSOURCE has been explicitly declared with the BUILTIN attribute.

Description

The ONSOURCE function returns a character string whose value is the context of the field that was being processed when the CONVERSION condition was signaled.

The ONSOURCE 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 character string.

Examples

DCL BT BIT(4);
ON CONVERSION BEGIN;
PUT LIST ('Incorrect string is:',ONSOURCE()); 
END;

T = '1021';

In the above example, the program will display the string "1021" that caused the conversion error to occur because only characters 0 and 1 are valid for a bit data type.

Restrictions

None.