Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 25
Creating a Named Process
name. You use the options parameter and, if appropriate, the nodename:length
parameter to specify whether you want to add a node name to the process name.
The following example requests a 6-character process name to include a node name.
The name is returned in the PROCESS^NAME parameter. This, and the remaining
examples are in TAL.
LITERAL SIX^CHARACTERS = 1,
INCLUDE^NODENAME = 0;
.
.
MAX^LENGTH := ZSYS^VAL^LEN^PROCESSDECR;
NAME^TYPE := SIX^CHARACTERS;
NODENAME ':=' "\CENTRAL" -> @S^PTR;
NODENAME^LENGTH := @S^PTR '-' @NODENAME;
OPTIONS := INCLUDE^NODENAME;
CALL PROCESSNAME_CREATE_(PROCESS^NAME:MAX^LENGTH,
NAME^LENGTH,
NAME^TYPE,
NODENAME:NODENAME^LENGTH,
OPTIONS);
You can pass the name returned in PROCESS^NAME to the PROCESS_LAUNCH_
procedure as a user-supplied name.
Using the PROCESS_LAUNCH_ Procedure
To have the system supply a name without using the PROCESSNAME_CREATE_
procedure, you can call the PROCESS_LAUNCH_ procedure with the
NAME_OPTIONS field set equal to the ZSYS^VAL^PCREATOPT^NAMEDBYSYS
literal in the input parameter structure. The information returned in the output
parameter structure includes a process descriptor, suitable for passing to the
FILE_OPEN_ procedure, and the length of the descriptor.
The operating system supplies a name for a new process in the following example:
.
.
PROG_NAME ':=' "REQFILE" -> @S^PTR;
@PARAM_LIST.PROGRAM_NAME := $XADR(PROG_NAME);
PARAM_LIST.PROGRAM_NAME_LEN := $DBL(@S^PTR '-' @PROG_NAME);
PARAM_LIST.NAME_OPTIONS := ZSYS^VAL^PCREATOPT^NAMEDBYSYS;
ERROR := PROCESS_LAUNCH_( PARAM_LIST,
ERROR_DETAIL,
OUTPUT_LIST:$LEN(OUTPUT_LIST),
OUTPUT_LIST_LEN);
Note. If the “run named" object-file flag is set (at compile or link time), then the system
generates a name even if the NAME_OPTIONS field in the input parameter structure is set
to 0.