1 SUB M11CAT & 2 !******************************************************************** & ! & ! & ! M11CAT & ! & ! Displays and/or updates the category definitions & ! & ! & !******************************************************************** & ! 3 ! Subprogram : M11CAT & ! Version : 1 21-Jan-82 & ! Programmer : John Montrym & ! Jean Fullerton & ! Releaser : Lou Abate & ! & ! 11 !-------------------------------------------------------------------- & ! & ! & ! C O P Y R I G H T & ! & ! & ! & ! (C) Copyright 1982 & ! Digital Equipment Corporation, Maynard, Massachusetts & ! & ! This software is furnished under a license for use only & ! on a single computer system and may be copied only with & ! the inclusion of the above copyright notice. This & ! software, or any other copies thereof, may not be pro- & ! vided or otherwise made available to any other person & ! except for use of such system and to one who agrees to & ! these license terms. Title to and ownership of the & ! software shall at all times remain in DIGITAL. & ! & ! The information in this software is subject to change & ! without notice and should not be construed as a commit- & ! ment by Digital Equipment Corporation. & ! & ! DIGITAL assumes no responsibility for the use or relia- & ! bility of its software on equipment that is not sup- & ! plied by DIGITAL. & ! & ! & !-------------------------------------------------------------------- 100 ! & ! Description & ! & ! & ! This subprogram interacts with the user to maintain the & ! current list of category names and types in each Mailing & ! List File. & ! & ! & ! errors: & ! & ! * Do not send the printed listing to the user's keyboard. & ! Use the display routine. It interfers with the screen drivers. & ! & ! * no error generated even if the device is not turned on & ! & ! * someone else logged into that device ?? & ! & ! * device unavailable if claim is Nonqueable, but really is & ! & ! & ! Calling Module: MAIL11 & ! & !-------------------------------------------------------------------- 200 ! & ! & ! Interfaces & ! & ! Common areas: & ! & ! COMERR - Error conditions variables & ! COMCON - General system constants & ! COMVAR - General system variables & ! & ! MAPPRM - System parameters from the Parameter File & ! MAPSCR - Screen parameters & ! MAPHDR - Mailing List File header record variables & ! & ! & ! Arguments: & ! & ! none & ! & !--------------------------------------------------------------------- 300 ! & ! & ! Input / Output & ! & ! & ! input: CH.ADD% read category definitions & ! & ! output: CH.ADD% update category definitions & ! CH.TEMP% print definitions to printer or file & ! & ! 400 !-------------------------------------------------------------------- & ! & ! Variable and Array Definitions & ! & ! & ! & ! BASE% Offset factor for cursor vertical positioning & ! C$ Temporary string variable & ! C.TYPE$ Temporary string variable & ! CHANGED% Logical variable to indicate whether to update cat.s & ! COLON% Position of colon within string & ! DEV$ Logical device name of printing device & ! DEV.NUM% Logical device number of printing device & ! DEV.NUM.BYTE.1$ low order byte of DEV.NUM% & ! ERL Line in which error occurred & ! ERR Set to error number after error & ! F.END% Logical flag to indicate if user typed CONTROL Z or C & ! FILE$ Name of printing device or file & ! FUNC$ Category function requested & ! I% general purpose FOR NEXT loop variable & ! J% general purpose FOR NEXT loop variable & ! LBASE% Offset for vertical positioning of cursor & ! OPTION% Category update number requested & ! OPTION$ Category update number requested & ! PRT% Printer number within array (0-4) & ! WORK$ temporary storage variable & ! & ! & !-------------------------------------------------------------------- 600 !-------------------------------------------------------------------- & ! & ! & ! COMMON Declarations & ! & ! & !-------------------------------------------------------------------- 650 !-------------------------------------------------------------------- & ! & ! & ! MAP Statements & ! & ! & !-------------------------------------------------------------------- 700 !-------------------------------------------------------------------- & ! & ! Subprograms & ! & ! & ! M11SCD Displays a screen full of text on the CRT & ! M11SCW Writes out text at specified coordinates & ! M11SCR Reads in text from specified coordinates & ! & ! & !-------------------------------------------------------------------- & ! 800 ! Subroutines & ! & ! 14000 Determine and open the printer device (or file) & ! & ! 14900 Display an error message and wait for user to read it & ! & !-------------------------------------------------------------------- & ! & ! Functions & ! & ! 18000 FN.DATE$ Returns today's date as DD-MMM-YY & ! & ! 18100 FN.TIME$ Returns current time as HH:MM & ! & 1000 !******************************************************************** & ! & ! & ! S T A R T S U B P R O G R A M L O G I C & ! & ! & !******************************************************************** & 1010 ON ERROR GOTO 19000 & \ ERR.CALLNAM$ = ERR.PROGNAM$ ! Save the calling subprogram & \ ERR.PROGNAM$ = "M11CAT VER:01" ! Set up our name & \ ERR.SUBNAM$ = "" & \ PLEASE.WAIT$ = "The next address is in use by another user. Please wait." & ! Set standard error trap. & ! Set up COMMON for error reporting. & 1050 CHANGED% = FALSE% & \ BASE% = 7% & ! Flag set if we might have to rewrite header record. & ! Define constants. & 1100 CALL M11SCD (SCR.CAT.MENU%) & ! Display menu. & 1130 CALL M11SCR (FUNC$, 19%, 45%, 1%, "U", "A", F.END%) & \ GO TO 9000 IF F.END% & \ IF FUNC$ = "?" THEN & CALL M11SCD (SCR.HLP.10%) & \ M11.MSG$ = "When through reading the display ..." & \ GO SUB 14900 & \ GO TO 1100 & ! Get input to menu. & ! Show help screen, if requested. & 1160 GO TO 3000 IF FUNC$ = "U" & \ GO TO 4000 IF FUNC$ = "P" & \ GO TO 5000 IF FUNC$ = "D" & ! Dispatch on entry. & 1170 M11.MSG$ = "Please type only U, P, D, ? or END" & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 1130 & ! If 'none of the above', offer help and ask again. & & 3000 !-------------------------------------------------------------------- & ! & ! & ! Update Definitions & ! & ! & !-------------------------------------------------------------------- & 3100 CALL M11SCD (SCR.CAT.UPDATE%) & \ FOR I% = 1% TO 6% & \ CALL M11SCW (HDR.CAT.PROMPT$(I%), BASE% + I%, 26%) & \ CALL M11SCW (HDR.CAT.TYPE$(I%), BASE% + I%, 42%) & \ NEXT I% & ! Show current settings. & 3150 CALL M11SCR (OPTION$, 23%, 42%, 1%, "", "N", F.END%) & \ GO TO 1100 IF F.END% & OR OPTION$ = "" & \ GO TO 3169 IF OPTION$ = "?" & \ OPTION% = VAL (OPTION$) & \ GO TO 3169 IF OPTION% < 1% & OR OPTION% > 6% & \ GO TO 3180 & ! Read in answer and give help if requested or needed. & 3169 \ M11.MSG$ = "Please type 1, 2, 3, 4, 5, or 6 (or END)." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 3150 & ! Get the user's reply, make sure it's within range. & & 3180 CALL M11SCR (ANS$, BASE%+OPTION%, 26%, 10%, & HDR.CAT.PROMPT$(OPTION%), "a", F.END%) & \ GO TO 1100 IF F.END% & \ IF ANS$ = "?" THEN & M11.MSG$ = "Type a name for this category." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 3180 & ! Get this label. Supply help if asked. & 3220 HDR.CAT.PROMPT$(OPTION%) = ANS$ & \ CHANGED% = TRUE% & ! Set the label to the answer. & 3250 CALL M11SCR (ANS$, BASE%+OPTION%, 42%, 1%, & HDR.CAT.TYPE$(OPTION%), "A", F.END%) & \ GO TO 1100 IF F.END% & \ IF ANS$ = "?" ! help & OR POS ("ADNYC", ANS$, 1%) = 0% ! error & OR ANS$ = "" THEN ! blank & M11.MSG$ = "Type A (alphanumeric), N (numeric), D (date), Y (Yes/No) or C (coded)." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 3250 & ! Get the category type, END takes us out of here. & ! '?' supplies a help message. & 3300 HDR.CAT.TYPE$(OPTION%) = ANS$ & \ GO TO 3150 & ! Validate answer. & ! If good, load up this category type & go do another. & & 4000 !-------------------------------------------------------------------- & ! & ! & ! Print the Definitions & ! & ! & !-------------------------------------------------------------------- & 4100 M11.OUTPUT.FORM$ = "S" & \ GO SUB 14000 & \ GO TO 1100 IF F.END% & ! Go define the printing device to use. & ! Return to main category menu, if user typed control Z or control C. & 4200 PRINT #CH.PRT%, FF+LF+LF; SPACE$(25%); "Category Definitions" & \ LINE$ = "Mailing List: " + EDIT$(M11.MAIL.FILE$,128%) & \ LINE$ = LINE$ + SPACE$ (55% - LEN(LINE$)) & \ PRINT #CH.PRT%, LF;LF; SPACE$ (55%); "Date: "; FN.DATE$(0%) & \ PRINT #CH.PRT%, LINE$; "Time: "; FN.TIME$(0%) & \ PRINT #CH.PRT%, LF+LF+LF;SPACE$(26%);" label type" & \ PRINT #CH.PRT%, SPACE$(26%);"---------- ------------" & \ FOR J% = 1% TO 6% & \ C.TYPE$ = "Alphanumeric" IF HDR.CAT.TYPE$(J%) = "A" & \ C.TYPE$ = " Numeric " IF HDR.CAT.TYPE$(J%) = "N" & \ C.TYPE$ = " Date " IF HDR.CAT.TYPE$(J%) = "D" & \ C.TYPE$ = " Yes/No " IF HDR.CAT.TYPE$(J%) = "Y" & \ C.type$ = " Coded " IF HDR.CAT.TYPE$(J%) = "C" \ C$ = " Category " + NUM1$ (J%) + ": " & \ PRINT #CH.PRT%, LF;SPACE$(9%);C$;HDR.CAT.PROMPT$(J%),C.TYPE$ & \ NEXT J% & \ PRINT #CH.PRT%, FF & \ CLOSE #CH.PRT% & ! Print category definitions listing, directly to device. & 4500 WORK$ = SYS (PRT.QUE.STRING$) IF PRT.QUEABLE% & ! Que the file to the requested device. & 4900 GO TO 1100 & ! Return to the category menu. & & 5000 !-------------------------------------------------------------------- & ! & ! & ! Display the Definitions & ! & ! & !-------------------------------------------------------------------- & 5100 CALL M11SCW (ERASE.EOS$, 1%, 1%) & \ M11.MSG$ = "Category Definitions" & \ CALL M11SCW (M11.MSG$, 1%, 30%) & \ CALL M11SCW ("Date: " + FN.DATE$(0%), 3%, 60%) & \ CALL M11SCW ("Time: " + FN.TIME$(0%), 4%, 60%) & \ CALL M11SCW ("Mailing List: " + EDIT$(M11.MAIL.FILE$,128%), 4%, 1%) & \ CALL M11SCW ("label type", BASE% - 1%, 32%) & \ FOR I% = 1% TO 6% & \ CALL M11SCW ("Category " + NUM1$(I%) + ":", BASE% +I%, 15%) & \ CALL M11SCW (HDR.CAT.PROMPT$(I%), BASE% +I%, 29%) & \ CALL M11SCW (HDR.CAT.TYPE$(I%), BASE% +I%, 44%) & \ NEXT I% & ! Blank the screen. & ! Put up the header labels. & ! Show all 6 category definitions. & 5200 M11.MSG$ = "When you are done reading the display ..." & \ GO SUB 14900 & \ GO TO 1100 & ! Wait for the user to read what's displayed, then return to menu. & & & 9000 !******************************************************************** & ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !******************************************************************** & 9100 IF CHANGED% THEN & HDR.KEY0$ = HDR.CHR$ + "000000000000001" & \ FIND #CH.ADD%, KEY #0% EQ HDR.KEY0$ & \ MOVE TO #CH.ADD%, HDR.ALL$ & \ SLEN% = LEN (HDR.ALL$) & \ UPDATE #CH.ADD%, COUNT SLEN% & \ GO TO 9900 & ELSE GO TO 9900 & ! If there were changes, set up header key to change header. & ! Find the header record, move the new information into the buffer & ! and then update the header record. & 9200 CALL M11SCW(PLEASE.WAIT$,24%,1%) & \ SLEEP 2% & \ GO TO 9100 & ! Handle a locked record at 9100. & 9900 ERR.PROGNAM$ = ERR.CALLNAM$ & \ GO TO 32767 & ! Restore the caller's name as the current subprogram. & ! Goto the end of the subprogram. & 10000 !******************************************************************** & ! & ! & ! Local Subroutines & ! & ! & !******************************************************************** & 15000 !******************************************************************** & ! & ! & ! Local Functions & ! & ! & !******************************************************************** & & 19000 !******************************************************************** & ! & ! & ! S T A N D A R D E R R O R H A N D L I N G & ! & ! & !******************************************************************** & 19010 GO TO 19990 IF ERN$ <> SEG$ (ERR.PROGNAM$,1%,6%) & ! Only tracing back an error from another subprogram. & 19100 IF ERR = 154% & THEN RESUME 9200 IF ERL = 9100% & ! Handle locking of the category record. & 19900 ERR.ERL% = ERL & \ ERR.ERR% = ERR & \ ERR.CODE% = FATAL.ERROR% & \ ERR.MSG$ = "Unexpected fatal error" & ! On a fatal error, set the error code. & 19990 ON ERROR GO BACK & ! Return to calling program for fatal error processing. & 32766 !*************************************************************** & ! & ! E N D O F S U B - P R O G R A M & ! & !*************************************************************** & 32767 SUBEND