Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 37
Using DEFINEs: An Example
!-----------------------------------------------------------
! Procedure to create DEFINEs. The procedure prompts the
! user for the DEFINE CLASS, then for each attribute that a
! DEFINE of the selected CLASS can have. When the attributes
! have all been entered, the procedure checks their validity
! and creates the DEFINE.
!-----------------------------------------------------------
PROC CREATE^DEFINES;
BEGIN
STRING .DEFINE^NAME[0:23];
STRING CMD;
INT ERROR;
INT COUNT^READ;
! Loop until all DEFINEs have been created:
DO BEGIN
! Prompt user for CLASS of DEFINE required
CMD := GET^DEFINE^CLASS;
! Call the appropriate procedure to prompt for the
! attributes for a DEFINE of the selected CLASS.
! Repeat if error on validation check.
DO^AGAIN:
CASE CMD OF
BEGIN
"1" -> CALL SET^MAP;
"2" -> CALL SET^SEARCH;
"3" -> CALL SET^TAPE;
"4" -> CALL SET^SPOOL;
"5" -> CALL SET^SORT;
"6" -> CALL SET^SUBSORT;
"7" -> CALL SET^CATALOG;
OTHERWISE -> CALL INVALID^SELECTION;
END;
! Check the working set for errors. If errors, have
! option to continue or stop.
ERROR := DEFINEVALIDATEWORK;
IF ERROR <> 0 THEN