!EXC.STACK()

!EXC.STACK()

Top  Previous  Next

 

The !EXC.STACK() subroutine displays a report based on the content of the @EXCEPTION.STACK variable after an exception is thrown.

 

 

Format

 

CALL !EXC.STACK

 

 

This call executes a system supplied subroutine that contains

 

IF @EXCEPTION.STACK # '' THEN

  DISPLAY '     Program name..................  Addr..  Line'

  LEVEL = 1

  FOR EACH PROG IN @EXCEPTION.STACK DELIMITER @FM

     NAME = FMT(PROG<1,1>, '30L')

     DISPLAY FMT(LEVEL, 'R%3  ') :

     SUBDATA = FIELD(PROG<1>, @VM , 2, *)

     SUBADDR = VSLICE(SUBDATA, 0, 1)

     SUBLINE = VSLICE(SUBDATA, 0, 2)

     LOOP

        DISPLAY FMT(REMOVE(NAME, MORE.NAME), '30L') : '  ' :

        DISPLAY DTX(REMOVE(SUBADDR, MORE.ADDR), 6) : '  ' :

        DISPLAY REMOVE(SUBLINE, MORE.LINE)

     WHILE MORE.NAME OR MORE.ADDR OR MORE.LINE

        DISPLAY '     ' :

     REPEAT

 

     LEVEL += 1

  NEXT PROG

END

 

Note that @EXCEPTION.STACK is only set if the CATCH clause that catches the exception uses the SAVING.STACK qualifier. This allows applications to use exceptions as part of the normal flow of execution rather than only for error handling without paying the performance cost of gathering the stack information.

 

 

See also:

Exception handling, THROW, TRY/CATCH