Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 42
Sending and Receiving the Startup Message
!------------------------------------------------------------
! Main procedure calls INIT to read and save the Startup
! message and open the IN and OUT files, creates a new
! process, then passes on its own Startup message to the
! new process.
!------------------------------------------------------------
PROC INITIAL MAIN;
BEGIN
STRUCT PARAM_LIST(PROCESS_LAUNCH_PARMS_);
!PROCESS_LAUNCH_ input parameter struct
STRUCT OUTPUT_LIST(ZSYS^DDL^SMSG^PROCCREATE^DEF);
!PROCESS_LAUNCH_ output parameter struct
INT .EXT ERROR_DETAIL;
INT .EXT OUTPUT_LIST_LEN; !length of PROCESS_LAUNCH output
! parameter struct as returned
INT F^NUM; !file number for process
! file
INT ERROR;
STRING PROGNAME[0:MAXLEN - 1]; !string form of program
! file name
! Read and save the Startup message and open the IN and OUT
! files:
CALL INIT;
! Start the new process:
PARAM_LIST ':=' P_L_DEFAULT_PARMS_; !initialize input
! parameter struct
PROGNAME ':=' "$XCEED.DJCEGD10.ZNEW" -> @S^PTR;
@PARAM_LIST.PROGRAM_NAME := $XADR(PROGNAME);
PARAM_LIST.PROGRAM_NAME_LEN := $DBL(@S^PTR '-' @PROGNAME);
PARAM_LIST.NAME_OPTIONS := ZSYS^VAL^PCREATOPT^NAMEDBYSYS;
ERROR := PROCESS_LAUNCH_( PARAM_LIST,
ERROR_DETAIL,
OUTPUT_LIST:$LEN(OUTPUT_LIST),
OUTPUT_LIST_LEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
! Open the new process:
ERROR := FILE_OPEN_(
OUTPUT_LIST.Z^PROCNAME:OUTPUT_LIST.Z^PROCNAME^LEN,
F^NUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;