Guardian Programmer's Guide

Table Of Contents
Communicating With Printers
Guardian Programmer’s Guide 421922-014
11 - 49
Sample Program for Using a Printer
!------------------------------------------------------------
! This is the main procedure. It calls the INIT procedure to
! initialize, then it goes into a loop calling GET^COMMAND to
! get the next user request and calling the procedure to
! carry out that request.
!------------------------------------------------------------
PROC PARTS MAIN;
BEGIN
STRING CMD;
CALL INIT;
! Loop indefinitely until user selects function x:
WHILE 1 DO
BEGIN
! Prompt for the next command:
CMD := GET^COMMAND;
! Call the function selected by user:
CASE CMD OF
BEGIN
"r", "R" -> CALL READ^RECORD;
"u", "U" -> CALL UPDATE^RECORD;
"i", "I" -> CALL INSERT^RECORD;
"p", "P" -> CALL PRINT^FILE;
"x", "X" -> CALL EXIT^PROGRAM;
OTHERWISE -> CALL ILLEGAL^COMMAND;
END;
END;
END;