Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 41
Sending and Receiving the Startup Message
!------------------------------------------------------------
! Procedure to perform initialization for the program.
!------------------------------------------------------------
PROC INIT;
BEGIN
STRING .IN^NAME[0:MAXLEN - 1]; !string form of IN file
! name
INT INNAME^LEN; !length of IN file
STRING .OUT^NAME[0:MAXLEN - 1]; !string form of OUT file
! name
INT OUTNAME^LEN; !length of OUT file
INT ERROR;
! Call INITIALIZER to read and save the Startup message:
CALL INITIALIZER(!rucb!,
!passthru!,
START^IT);
! Convert 12-word file name from Startup message into a
! variable-length string:
ERROR := OLDFILENAME_TO_FILENAME_(
CI^STARTUP.INFILE.VOLUME,
IN^NAME:MAXLEN,
INNAME^LEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
! Open the input file.
ERROR := FILE_OPEN_(IN^NAME:INNAME^LEN,INNUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
! Convert the output file name:
ERROR := OLDFILENAME_TO_FILENAME_(
CI^STARTUP.OUTFILE.VOLUME,
OUT^NAME:MAXLEN,
OUTNAME^LEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
! Open the output file:
ERROR := FILE_OPEN_(OUT^NAME:OUTNAME^LEN,OUTNUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
END;