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.

<strong>Caché</strong> <strong>ObjectScript</strong> Functions• ECODE — The error code of any error that occurred at the specified context level(available only in error stack contexts).When the requested information is not available at the specified context level, the two argumentform of $STACK returns the null string.ExampleThe following example demonstrates some of the information that $STACK can return:STAC ;SET $ECODE=""XECUTE "DO First"QUITFirst SET varSecond=$$Second()QUITSecond() FOR loop=0:1:$STACK(-1) {WRITE !,"Context level:",loop,?25,"Context type: ",$STACK(loop)WRITE !,?5,"Current place: ",$STACK(loop,"PLACE")WRITE !,?5,"Current source: ",$STACK(loop,"MCODE")WRITE ! }QUIT 1>DO ^STACContext level: 0 Context type:Current place: @ +1Current source: DO ^STACContext level: 1 Context type: DOCurrent place: STAC+2^STAC +1Current source: XECUTE "DO First"Context level: 2 Context type: XECUTECurrent place: @ +1Current source: DO FirstContext level: 3 Context type: DOCurrent place: First^STAC +1Current source: First SET Second=$$SecondContext level: 4 Context type: $$Current place: Second+2^STAC +4Current source: WRITE !,?5,"Current source: ",$STACK(loop,"MCODE")Notes$STACK Contains Error Stack Context When Errors OccurError stack context information is only available after an error occurs and the value of the$ECODE special variable contains a non-null value. In this case, $STACK returns informationabout the error stack context rather than an active stack context at the specified context level.When error stack context information is not available and you specify the current contextlevel with the two-argument form of $STACK, <strong>Caché</strong> returns information about the currentlyexecuting command.302 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!