Guardian Programmer's Guide

Table Of Contents
Interfacing With the ERROR Program
Guardian Programmer’s Guide 421922-014
20 - 11
Using the ERROR Process: An Example
!------------------------------------------------------------
! Procedure to copy the Startup message into a global
! structure.
!------------------------------------------------------------
PROC SAVE^STARTUP^MESSAGE(RUCB,START^DATA,MESSAGE,
LENGTH,MATCH)VARIABLE;
INT .RUCB;
INT .START^DATA;
INT .MESSAGE;
INT LENGTH;
INT MATCH;
BEGIN
! Copy the Startup message into the CI^STARTUP structure:
CI^STARTUP.MSGCODE ':=' MESSAGE[0] FOR LENGTH/2;
END;
!------------------------------------------------------------
! Procedure to perform initialization for the program. It
! calls INITIALIZER to read and copy the Startup message into
! the global data area and then opens the IN file specified
! in the Startup message.
!------------------------------------------------------------
PROC INIT;
BEGIN
STRING .TERM^NAME[0:MAXFLEN - 1];
INT TERMLEN;
INT ERROR;
! Read and save the Startup message:
CALL INITIALIZER(!rucb!,
!passthru!,
SAVE^STARTUP^MESSAGE);
! Open the IN file:
ERROR := OLDFILENAME_TO_FILENAME_(
CI^STARTUP.INFILE.VOLUME,
TERM^NAME:MAXFLEN,TERMLEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
ERROR := FILE_OPEN_(TERM^NAME:TERMLEN,TERMNUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
END;