Guardian Programmer's Guide

Table Of Contents
Using the File System
Guardian Programmer’s Guide 421922-014
2 - 38
Accessing Files: An Example
!------------------------------------------------------------
! This is the main procedure. It calls the INIT procedure to
! initialize and then goes into a loop calling GET^COMMAND
! to get the next user request and then calling a procedure
! to carry out the selected request.
!------------------------------------------------------------
PROC LOGGER 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;
"a", "A" -> CALL APPEND^RECORD;
"x", "X" -> CALL EXIT^PROGRAM;
OTHERWISE -> CALL INVALID^COMMAND;
END;
END;
END;