Guardian Programmer's Guide

Table Of Contents
Communicating With Printers
Guardian Programmer’s Guide 421922-014
11 - 42
Sample Program for Using a Printer
! Print the unit price:
START^LINE;
S^PTR ':=' [%33,"&dDUnit Price:",%33,"&d@ $"]
-> @S^PTR;
PUT^INT(PART^RECORD.UNIT^PRICE);
CALL PRINT^OUT(PRINTERNUM,SBUFFER,@S^PTR '-' @SBUFFER);
CALL PRINT^OUT(PRINTERNUM,SBUFFER,0);
END;
END;
!------------------------------------------------------------
! Procedure for reading records. The user selected function
! "r." The start of the read is selected by approximate key
! positioning. The user has the option of sequentially
! reading subsequent records.
!------------------------------------------------------------
PROC READ^RECORD;
BEGIN
INT COUNT^READ;
INT ERROR;
! Prompt the user for the part number:
PRINT^BLANK;
SBUFFER ':=' "Enter Part Number: " -> @S^PTR;
CALL WRITEREADX(TERMNUM,SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
! Position approximately to the selected record:
CALL KEYPOSITION(PARTFILE^NUM,SBUFFER,
!key^specifier!,
COUNT^READ,0);
IF <> THEN CALL FILE^ERRORS(PARTFILE^NUM);