Guardian Programmer's Guide

Table Of Contents
Debugging, Trap Handling, and Signal Handling
Guardian Programmer’s Guide 421922-014
25 - 9
Handling Trap Conditions
To specify a saveabend file for the process, set bit 13 to 1.
You can accomplish the same things using the PROCESS_LAUNCH_ procedure. The
difference is that the debug options bits are passed to PROCESS_LAUNCH_ in a field
in a structure instead of in a separate parameter.
The following example uses PROCESS_CREATE_ to specify the Inspect program,
regardless of any value supplied by the linker or compiler:
OBJFILE ':=' "REQFILE" -> @S^PTR;
OBJFILENAME^LENGTH := @S^PTR '-' @OBJFILE;
NAME^OPTION := ZSYS^VAL^PCREATOPT^NAMEINCALL;
PROCESS^NAME ':=' "$REQ" -> @S^PTR;
PROCESS^NAME^LENGTH := @S^PTR '-' @PROCESS^NAME;
DEBUG^OPTIONS := 0;
DEBUG^OPTIONS.<13> := 1;
DEBUG^OPTIONS.<14> := 1;
DEBUG^OPTIONS.<15> := 1;
ERROR := PROCESS_CREATE_(OBJFILE:OBJFILENAME^LENGTH,
!library^file:length!,
!swap^file:length!,
!ext^swap^file:length!,
!priority!,
!processor!,
PROCESS^HANDLE,
!error^detail!,
NAME^OPTION,
PROCESS^NAME:PROCESS^NAME^LENGTH,
PROCESS^DESCRIPTOR:MAXLEN,
PROCESS^DESCRIPTOR^LENGTH,
!nowait^tag!,
!hometerm:length!,
!memory^pages!,
!job^id!,
!create^options!,
!defines:length!,
DEBUG^OPTIONS);
Handling Trap Conditions
During program execution of TNS or accelerated programs, all error and exception
conditions not related to input or output are handled by a returned error parameter
value. Conditions that are trapped typically are caused by coding errors in your
application program or by a shortage of resources. For example, errors such as
“arithmetic overflow” might be caused by erroneous application code, whereas an error
such as “no memory available” might originate from the memory manager.
Table 25-1 provides a summary of the conditions that can cause your process to trap.
Each trap condition is identified by a trap number.