11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

$ZTRAP• $ZUTIL(193) Interconvert Universal (UTC) Time and Local Time function• $HOROLOG special variable• $ZTIMESTAMP special variable$ZTRAPContains the name of the current error trap handler.$ZTRAP$ZTDescription$ZTRAP contains the tag name and/or routine name of the current error trap handler. Thereare three ways to set $ZTRAP:• SET $ZTRAP=“location”• SET $ZTRAP=“*location”• SET $ZTRAP=“^%ET” or “^%ETN”Here location can be specified as tag (a label in the current routine), ^routine (the beginningof a specified external routine), or tag^routine (a specified label in a specified external routine).$ZTRAP supports tag+offset in some contexts (but not in procedures). This optional +offsetis an integer specifying the number of lines to offset from tag. <strong>InterSystems</strong> recommendsthat you avoid the use of a line offset when specifying location.If you specify a non-existent location in the current routine, <strong>Caché</strong> issues a errormessage.By default, error trapping is not enabled, and $ZTRAP contains the null string (""). To enableerror trapping, set $ZTRAP to the error trap handler by specifying its location. For example:IF $ZTRAP="" {WRITE !,"$ZTRAP not set" }ELSE {WRITE !,"$ZTRAP already set: ",$ZTRAPSET oldtrap=$ZTRAP }SET $ZTRAP="Etrap1^Handler"WRITE !,"$ZTRAP set to: ",$ZTRAP// program codeSET $ZTRAP=oldtrapWRITE !,"$ZTRAP restored to: ",$ZTRAP<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 495

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!