Print Page as PDF
%ZTER (ERROR RECORDING) ICR (1621)

%ZTER (ERROR RECORDING)    ICR (1621)

Name Value
NUMBER 1621
IA # 1621
DATE CREATED 1996/10/04
CUSTODIAL PACKAGE KERNEL
CUSTODIAL ISC San Francisco
USAGE Supported
TYPE Routine
DBIC APPROVAL STATUS APPROVED
ROUTINE %ZTER
NAME %ZTER (ERROR RECORDING)
GENERAL DESCRIPTION
This IA is to document the supported calls into the
%ZTER routine in support of standard error trapping.
STATUS Active
DURATION Till Otherwise Agreed
ID %ZTER
COMPONENT/ENTRY POINT
COMPONENT/ENTRY POINT COMPONENT DESCRIPTION VARIABLES
$$NEWERR
This is an extrinsic function to report if the
current platform supports the new standard error trapping.  It always returns
1.

All current VA systems support the new error trapping standard.  The SACC has
being changed to allow the use of $ESTACK, $ETRAP, $ECODE There are still
inconsistency when mixing the old and new error trapping.

To set a new trap:
N $ESTACK,$ETRAP S $ETRAP="D ERROR^XXX" or
N $ESTACK,$ETRAP S $ETRAP="S $EC="""" Q -1"

These are still valid.  Usage to set new trap:
N $ESTACK,$ETRAP S $ETRAP="D ERROR^XXX"

Usage to set old style trap:
N $ESTACK,$ETRAP S $ETRAP=""
S X="ERROR^YYY",@^%ZOSF("TRAP")

The vendors differ in how they support the mixing of old and new forms of
error trapping. A common way is to look at the current stack frame and, if it
finds the old form, it uses that; otherwise it looks for the new style. This
gives the old style a local scope of the current stack level.
UNWIND
This entry point is used after a package error trap
to quit back to the calling routine. Control returns to the level above the
one that NEWED $ESTACK.

MAIN   S X=1 D SUB
W X
Q SUB    N $ESTACK,$ETRAP S $ETRAP="D ERROR"
S X=1/0
Q

Usage: ERROR  D ^%ZTER ;This will record the error info and clear $ECODE
S ^XXX="Incomplete record"
G UNWIND^%ZTER
%ZTER
This routine can be called from the top DO ^%ZTER to
record the variables at the current time into the error trap. This will clear
$ZE and $ECODE.
VARIABLES TYPE VARIABLES DESCRIPTION
%ZT Input
(optional) The %ZT array can be used to identify a
global node whose descendents should be recorded in the error log. When called
within the standard Kernel error trap, %ZT is set to record the user's
location in the menu system.

>S %ZT("^TMP($J)")=""
>D ^%ZTER
APPERROR
This entry will point allow developers to pass-in the
error message that will be displayed in the error trap listing.

Usage: D APPERROR^%ZTER("My App Error")
VARIABLES TYPE VARIABLES DESCRIPTION
%ZT Input
The same as calling %ZTER.
DATE ACTIVATED 2009/08/12