ONLOC Function

Purpose

Returns the name of an entry in which a condition was raised.

Syntax

ONLOC()

Description

When the ONLOC function is called under the control of an ON-unit (that is, from the ON-unit or any procedure called by the ON-unit), it returns a character string whose value is the name of the entry in which the condition was raised that caused the ON-unit to be invoked. If a call to the ONLOC function is made not under the control of an ON-unit, ONLOC() returns the null string.

Examples

SUBPROG: PROCEDURE(X) RETURNS(FLOAT BIN(23)); 
   DECLARE X FLOAT BIN(23);
   ON ERROR BEGIN;
      PUT LIST('Error at ', ONLOC());
      PUT SKIP;
      GOTO HIGHER_LEVEL_EXIT;
      END;
   X = X / (X-X);
   RETURN(X);
END SUBPROG;

Execution of this subprogram causes the following text to be displayed:

Error at SUBPROG

Restrictions

This feature is currently available only on Sun SPARC Solaris 2.