Guardian Programmer's Guide

Table Of Contents
Communicating With Printers
Guardian Programmer’s Guide 421922-014
11 - 48
Sample Program for Using a Printer
!------------------------------------------------------------
! This procedure does the initialization for the program.
! It calls INITIALIZER to dispose of the startup messages.
! It opens the home terminal and the data file used by the
! program.
!------------------------------------------------------------
PROC INIT;
BEGIN
STRING .PARTFILE^NAME[0:MAXFLEN - 1]; !name of part file
INT PARTFILE^LEN;
STRING .TERM^NAME[0:MAXFLEN - 1]; !terminal file
INT TERMLEN;
INT ERROR;
! Read and save startup message:
CALL INITIALIZER(!rucb!,
!passthru!,
SAVE^STARTUP^MESSAGE);
! Open the terminal file (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 <> THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
! Open the part file with a sync depth of 1:
PARTFILE^NAME ':=' "$XCEED.DJCEGD10.PARTFILE" -> @S^PTR;
PARTFILE^LEN := @S^PTR '-' @PARTFILE^NAME;
ERROR := FILE_OPEN_(PARTFILE^NAME:PARTFILE^LEN,
PARTFILE^NUM,
!access!,
!exclusion!,
!nowait^depth!,
1);
IF <> THEN
CALL FILE^ERRORS^NAME(PARTFILE^NAME:PARTFILE^LEN,ERROR);
END;