Guardian Programmer's Guide

Table Of Contents
Communicating With Printers
Guardian Programmer’s Guide 421922-014
11 - 46
Sample Program for Using a Printer
!------------------------------------------------------------
! Procedure for inserting a record. The user selected
! function "i." The user is prompted to enter the new record.
! The procedure inserts the new record in the appropriate
! place in the file.
!------------------------------------------------------------
PROC INSERT^RECORD;
BEGIN
INT ERROR;
PRINT^BLANK;
! Prompt the user for the new record:
CALL ENTER^RECORD(NEW);
! Write the new record to the file:
CALL WRITEX(PARTFILE^NUM,PART^RECORD,$LEN(PART^RECORD));
IF <> THEN
BEGIN
CALL FILE_GETINFO_(PARTFILE^NUM,ERROR);
IF ERROR = 10 THEN
BEGIN
PRINT^BLANK;
PRINT^STR("A record exists with that part number.");
PRINT^STR("Your new one was not entered.");
END
ELSE
BEGIN
CALL FILE^ERRORS(PARTFILE^NUM);
END;
END;
END;
!------------------------------------------------------------
! Procedure to exit the program.
!------------------------------------------------------------
PROC EXIT^PROGRAM;
BEGIN
CALL PROCESS_STOP_;
END;