Guardian Programmer's Guide

Table Of Contents
Interfacing With the ERROR Program
Guardian Programmer’s Guide 421922-014
20 - 2
Creating an ERROR Process
Creating an ERROR Process
To create the ERROR process, you can use the PROCESS_CREATE_ procedure.
You can create the process in a waited or nowait manner. The following example
creates a named ERROR process and waits for the creation to finish:
LITERAL MAXPDLEN = ZSYS^VAL^LEN^PROCESSDESCR;
STRING OBJFILENAME; !object file name
INT .PROCESS^HANDLE[0:9], !process handle of ERROR
! process
OBJFILENAME^LENGTH, !length of ERROR file name
NAME^OPTION; !specifies want process
! named by system
STRING .PROCESS^DESCR[0:MAXPDLEN -1],!process descriptor
INT PROCESS^DESCR^LEN, !length of process
! descriptor
ERROR, !error return from
! PROCESS_CREATE_
.
.
OBJFILENAME ':=' "$SYSTEM.SYSTEM.ERROR" -> @S^PTR;
OBJFILENAME^LENGTH := @S^PTR '-' @OBJFILENAME;
NAME^OPTION := ZSYS^VAL^PCREATOPT^NAMEDBYSYS;
ERROR := PROCESS_CREATE_(OBJFILENAME:OBJFILENAME^LENGTH,
!library^filename:library^file^len!,
!swap^filename:swap^file^len!,
!ext^swap^file^name:ext^swap^len!,
!priority!,
!processor!,
PROCESS^HANDLE,
!error^detail!,
NAME^OPTION,
!name:length!,
PROCESS^DESCR:MAXPDLEN,
PROCESS^DESCR^LEN);
IF ERROR^RETURN <> 0 THEN ...
The following example creates an ERROR process, initiating the creation in a nowait
manner. The Process create message (message -102) is delivered to the $RECEIVE
file when the creation is complete. This message contains the process handle and
process descriptor of the created process.
INT .BUFFER[0:BUFSIZE];
STRING .SBUFFER ':=' @BUFFER '<<' 1;
OBJFILENAME ':=' "$SYSTEM.SYSTEM.ERRORX" -> @S^PTR;
OBJFILENAME^LENGTH := @S^PTR '-' @OBJFILENAME;
NAME^OPTION := ZSYS^VAL^PCREATOPT^NAMEDBYSYS;
NOWAIT^TAG := 1D;