Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 23
Creating an Unnamed Process
Creating an Unnamed Process
Remember that processes can be named or unnamed. To create an unnamed
process, you call the PROCESS_LAUNCH_ procedure with the NAME_OPTIONS field
set to 0 in the input parameter structure. To set the NAME_OPTIONS field, you can
use the ZSYS^VAL^PCREATOPT^NONAME literal from the ZSYSTAL file. All you
need to supply is the program file name.
The following example creates an unnamed process:
?NOLIST
?SOURCE $SYSTEM.SYSTEM.EXTDECS0(PROCESS_LAUNCH_);
?SOURCE $SYSTEM.SYSTEM.DLAUNCH(PROCESS_LAUNCH_DECS);
?SOURCE $SYSTEM.SYSTEM.ZSYSTAL;
?LIST
.
.
STRING PROG_NAME[0:ZSYS^VAL^LEN^FILENAME-1];
INT .EXT ERROR_DETAIL,
OUTPUT_LIST_LEN;
STRUCT OUTPUT_LIST(ZSYS^DDL^SMSG^PROCCREATE^DEF);
STRUCT PARAM_LIST(PROCESS_LAUNCH_PARMS_);
.
.
PARAM_LIST ':=' P_L_DEFAULT_PARMS_; ! initialize param struct
PROG_NAME ':=' "PROGFILE" -> @S^PTR; ! program file name
@PARAM_LIST.PROGRAM_NAME := $XADR(PROG_NAME);
PARAM_LIST.PROGRAM_NAME_LEN := $DBL(@S^PTR '-' @PROG_NAME);
PARAM_LIST.NAME_OPTIONS := ZSYS^VAL^PCREATOPT^NONAME;
ERROR := PROCESS_LAUNCH_( PARAM_LIST,
ERROR_DETAIL,
OUTPUT_LIST:$LEN(OUTPUT_LIST),
OUTPUT_LIST_LEN);
In this example, the OUTPUT_LIST structure returns the process handle and the
unnamed form of the process descriptor, which is suitable for supplying as the
file-name parameter to the FILE_OPEN_ procedure. See Section
2, Using the File
System, for a discussion of process file names.
Creating a Named Process
When creating a named process, you can either specify the process name yourself or
have the operating system assign a name for you.
Specifying a Process Name
The next example is in C. To specify a process name, you must set the name_options
field to 1 and supply the process name in the process_name field in the input
parameter structure. To set the name_options field, you can use the
ZSYS^VAL^PCREATOPT^NAMEINCALL literal.