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.

HALTIn the following example, HALT invokes the halt trap routine specified in $HALT. In thiscase, it is the second HALT command that actually halts execution:MainNEW $ESTACKSET $HALT="OnHalt"WRITE !,"Main $ESTACK= ",$ESTACK // 0DO SubAWRITE !,"this should never display"QUITSubAWRITE !,"SubA $ESTACK= ",$ESTACK // 1HALT // invoke the OnHalt routineWRITE !,"this should never display"QUITOnHaltWRITE !,"OnHalt $ESTACK= ",$ESTACK // 0// clean-up and reporting operationsHALT // actually halt the current processQUITNotesEffects of HALTWhen HALT terminates a process and causes an exit from <strong>Caché</strong> the system automaticallyrelinquishes all locks and closes all devices owned by the process. This ensures that the haltedprocess does not leave behind locked variables or unreleased devices.HALT behaves the same whether it is encountered in routine code or entered from the programmermode prompt. In either case, you must log in again to return to <strong>Caché</strong> <strong>ObjectScript</strong>.HALT TrapsExecution of a HALT command is interrupted by a halt trap. Halt traps are established usingthe $HALT special variable.If a halt trap has been established for the current context frame, issuing a HALT commandinvokes the halt trap routine specified by $HALT. The HALT command itself is not executed.If a halt trap has been established for a lower context frame, a HALT command removescontext frames from the frame stack until the context frame with the halt trap is reached.HALT then invokes the halt trap routine specified by $HALT and ceases execution.See Also• $HALT special variable• Debugging in Using <strong>Caché</strong> <strong>ObjectScript</strong><strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 51

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

Saved successfully!

Ooh no, something went wrong!