1 SUB M11SUB (UPDATE%) & 2 !******************************************************************** & ! & ! & ! M11SUB & ! & ! Removes, Prints, Displays and Lists the sublist definitions & ! & ! & !******************************************************************** & ! 3 ! Subprogram : M11SUB & ! Version : 1 24-Jan-82 & ! Programmer : Jean Fullerton & ! Releaser : Don Gohn & ! & ! & !-------------------------------------------------------------------- 11 ! & ! C O P Y R I G H T & ! & !-------------------------------------------------------------------- 100 ! & ! Description & ! & ! This subprogram handles the sublist definition setup, listing, & ! and display/printing. The updating of the definitions is handled & ! by M11SUP. & ! & ! & ! & ! Assumptions: & ! & ! * There are no more than 9 sublist records for any given sublist & ! definition. & ! & ! * M11INT initializes M11.SUBLIST.CODE% to 0% and & ! M11.LAST.LINE% to 0% & ! & ! & ! label SEL.OP.CODE$ SEL.ACC.REJ$ & ! ---------- ------------ ------------ & ! a is 1 A & ! b is not 1 R & ! c above 2 A & ! d not above 2 R & ! e below 3 A & ! f not below 3 R & ! g between 4 A & ! h not between 4 R & ! & ! & ! Calling Module: SMAIL & ! & !-------------------------------------------------------------------- 200 ! & ! & ! Interfaces & ! & ! Common areas: & ! & ! COMERR - Error conditions variables & ! COMCON - General system constants & ! COMVAR - General system variables & ! & ! MAPMLF - Mailing List File contents & ! MAPHDR - Mailing List File header parameters & ! MAPSUB - Sublist Record contents & ! MAPSEL - Sublist Definition array & ! MAPSCR - Screen variables & ! MAPPRM - System parameters & ! MAPPRT - Printer device variables & ! MAPLOC - labels for sublist definitions & ! & ! Arguments: & ! & ! UPDATE% - output, TRUE if user wants to update a definition & ! & ! & !--------------------------------------------------------------------- 300 ! & ! & ! Input / Output & ! & ! & ! Channel Filename Map name Status at entry/exit & ! ------- --------- -------- -------------------- & ! CH.ADD - MAPMLF open / open & ! CH.PRT - closed / closed & ! 400 !-------------------------------------------------------------------- & ! & ! Variable and Array Definitions & ! & ! & ! & ! ANS$ User's answer to prompt & ! CAT% Category index & ! COMP$ Description of comparison to be made & ! ERL Line in which error occurred & ! ERR Set to error number after error & ! F.END% TRUE if a CTRL/Z was typed & ! FUNC$ Letter code for the function to be performed & ! LABEL$ Labels of fields which may be compared to & ! LINE% Index of the sublist definition line number & ! LINE.IN.REC% Offset of the line within the sublist record & ! MAX.REC% Maximum number of sublist records & ! NAM$ Name of the sublist & ! REC% Record index & ! SAV.PRIME.ID$ Prefix of sublist record primary key & ! WORK$ Intermediate working variable & ! Z9$ Intermediate working 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 & ! & ! 10100 Clear the Sublist Definition & ! 11700 Display the Sublist Definition & ! 12000 Load the Sublist Definition Area & ! 13200 Output a Sublist Definition & ! 14000 Determine and Open a Printer Device & ! 14800 Notify User of Status & ! 14900 Handle Error Message & ! & !-------------------------------------------------------------------- & ! & ! Functions & ! & ! FN.DEPARSE$ Display all sublist definition lines in English & ! FN.DATE$ Return the date in DEC standard format & ! FN.TIME$ Return the time in 24 hour format & ! 900 !-------------------------------------------------------------------- & ! & ! & ! DIMENSION Declarations & ! & ! & !-------------------------------------------------------------------- & & 920 DIMENSION LABEL$(16%) & ,COMP$(8%) & 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$ = "M11SUB VER:01" ! Set up our name. & \ ERR.SUBNAM$ = "" & ! Set standard error trap. & ! Set up COMMON for error reporting. & 1050 UPDATE% = FALSE% & ! Define constants. Initialize flag that indicates user wants to & ! update a sublist definition. & 1060 LABEL$(1%) = "Primary ID " & \ LABEL$(2%) = "Alternate ID " & \ LABEL$(3%) = "Counter " & \ LABEL$(4%) = "Zip code " & \ LABEL$(4%+CAT%) = HDR.CAT.PROMPT$(CAT%) FOR CAT% = 1% TO 6% & \ LABEL$(11%) = "Name " & \ LABEL$(12%) = "Addr line 1 " & \ LABEL$(13%) = "Addr line 2 " & \ LABEL$(14%) = "Addr line 3 " & \ LABEL$(15%) = "City/town " & \ LABEL$(16%) = "State/country" & & \ COMP$(1%) = "is " & \ COMP$(2%) = "is not " & \ COMP$(3%) = "above " & \ COMP$(4%) = "not above " & \ COMP$(5%) = "below " & \ COMP$(6%) = "not below " & \ COMP$(7%) = "between " & \ COMP$(8%) = "not between" & ! Initialize labels. & 1080 NAM$ = M11.SUBLIST.NAME$ & ! Initialize sublist name. & 1100 !-------------------------------------------------------------------- & ! & ! & ! Sublist Menu & ! & ! & !-------------------------------------------------------------------- & 1150 CALL M11SCD (SCR.SUB.MENU%) & ! Show the sublist menu. & 1170 CALL M11SCR (FUNC$, 21%, 41%, 1%, "U", "A", F.END%) & \ GO TO 9000 IF F.END% & ! Get the entry, clear out if 'END'. & 1180 IF FUNC$ = "?" THEN & CALL M11SCD (SCR.HLP.11%) & \ M11.MSG$ = " " & \ GO SUB 14900 & \ GO TO 1150 & ! Show help screen. & 1190 IF POS ("URPDS", FUNC$, 1%) = 0% THEN & CALL M11SCW ("Type U, R, P, D or S (or ? or END)", 24%, 1%) & \ GO TO 1170 & ! Handle wrong answers. & & 1195 GO TO 7000 IF FUNC$ = "S" & ! Go off to list all the sublist definition names for this mail list. & 1200 !-------------------------------------------------------------------- & ! & ! & ! Sublist Name & ! & ! & !-------------------------------------------------------------------- & 1205 CALL M11SCW (ERASE.EOS$, 1%, 1%) & \ CALL M11SCW ("Enter the name for this sublist:", 11%, 11%) & ! Clear previous screen. Ask for the sublist name. & 1210 CALL M11SCR (NAM$, 11%, 45%, 10%, NAM$, "A", F.END%) & \ GO TO 1080 IF F.END% & ! Get the sublist name. & ! 'END' means return to sublist menu. & & 1220 IF NAM$ = "?" THEN & M11.MSG$ = "Type up to 10 characters to name a sublist definition." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 1210 & ! Handle a call for help. & 1230 M11.NEW.SUBLIST% = FALSE% & \ NAM$ = "TEMPORARY" IF NAM$ = "" & \ IF NAM$ = "TEMPORARY" & THEN IF M11.SUBLIST.CODE% = TEMP% & AND M11.LAST.LINE% > 0% THEN GO TO 1800 & ELSE GO TO 1260 & ! If the user wants a temporary sublist. & ! Go dispatch if a temporary list exists, & ! otherwise go check if this is a creation (update). & 1250 SAV.PRIME.ID$ = SUB.CHR$ + SEG$ (NAM$ + SPACE$(10%), 1%, 10%) & \ SUB.KEY0$ = SAV.PRIME.ID$ + "00001" & \ SUB.KEY1$ = STRING$ (10%,0%) & ! Primary ID is RS char plus name (left justified, space filled). & 1255 GET #CH.ADD%, KEY #0% EQ SUB.KEY0$ & \ UNLOCK #CH.ADD% & \ GO SUB 10100 IF NAM$ <> M11.SUBLIST.NAME$ & AND (M11.SUBLIST.CODE% = TEMP% & OR M11.SUBLIST.CODE% = PERM%) & \ M11.SUBLIST.CODE% = PERM% & \ M11.SUBLIST.NAME$ = NAM$ & ! Try to get this sublist definition record out of the main file. & ! If it exists, clear out the old sublist definition. & ! Error traps to 1260 if it doesn't exist. & 1258 GO SUB 12000 & \ GO TO 1800 & ! Fill the sublist area. & ! Go dispatch on function. & 1260 IF FUNC$ <> "U" & THEN M11.MSG$ = "Sublist " + NAM$ + " does not exist." + BEL & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 1210 & ELSE M11.NEW.SUBLIST% = TRUE% & \ GO SUB 10100 IF M11.SUBLIST.CODE% = TEMP% & OR M11.SUBLIST.CODE% = PERM% & \ M11.SUBLIST.CODE% = PERM% & \ M11.SUBLIST.CODE% = TEMP% IF NAM$ = "TEMPORARY" & \ M11.SUBLIST.NAME$ = NAM$ & & ! This line of code is only executed if the sublist does not exist. & ! If there is no such sublist, then yell at user. (It's okay & ! if we're in update mode -- we assume the user wants to create a & ! new sublist definition -- clear old sublist definintion). & 1800 GO TO 3000 IF FUNC$ = "R" & \ GO TO 4000 IF FUNC$ = "P" & \ GO TO 5000 IF FUNC$ = "D" & \ UPDATE% = TRUE% & \ GO TO 9000 & ! Dispatch on function. If function is "update", then set flag and & ! return to MAIL11 (M11SUP will be called). & 3000 !-------------------------------------------------------------------- & ! & ! & ! Remove & ! & ! & !-------------------------------------------------------------------- & & 3020 GO SUB 11700 & ! Display definition to be removed. & 3030 IF M11.SUBLIST.CODE% = TEMP% THEN & M11.MSG$ = "(This temporary sublist would be removed anyway when done.)" & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ SLEEP 4% & ! Send an informational message to user. & 3040 M11.MSG$ = "Type REMOVE to delete this sublist definition:" & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ CALL M11SCR (ANS$, 24%, 49%, 6%, "", "A", F.END%) & \ IF ANS$ = "?" THEN M11.MSG$ = "Press RETURN to keep the definition" & \ GO SUB 14900 & \ GO TO 3040 & ! Verify that this definition should be removed. & 3050 IF F.END% OR ANS$ <> "REMOVE" THEN & M11.MSG$ = "The sublist definition will NOT be removed." & \ GO SUB 14900 & \ GO TO 1080 & ! If answer is not precisely REMOVE or remove then don't. & 3060 IF M11.SUBLIST.CODE% = TEMP% THEN & M11.MSG$ = "The temporary definition has been removed." & \ GO TO 3090 & ! Set message for temporary definition removal. & 3080 FOR REC% = 1% TO 9% & \ SUB.KEY0$ = SAV.PRIME.ID$ + "0000" + NUM1$ (REC%) & \ GET #CH.ADD%, KEY #0% EQ SUB.KEY0$ & \ DELETE #CH.ADD% & \ NEXT REC% & ! Get and delete all records for this sublist. & ! Control resumes at 3085 when GET fails. & 3085 M11.MSG$ = "Sublist definition " + NAM$ + " has been removed." & ! Set user notification message. & 3090 GO SUB 14800 & \ NAM$ = "" & \ M11.SUBLIST.NAME$ = "" & \ SEL.ALL$ = "" & \ M11.LAST.LINE% = 0% & \ M11.SUBLIST.CODE% = 0% & ! Notify user that sublist definition was removed. & ! Reset definition variables. & 3100 GO TO 1100 & ! Return to the Sublist Menu. & 4000 !-------------------------------------------------------------------- & ! & ! & ! Print & ! & ! & !-------------------------------------------------------------------- & 4020 M11.OUTPUT.FORM$ = "S" & \ GO SUB 14000 & \ GO TO 1080 IF F.END% & ! Go define the printing device to use. & ! Return to main sublist menu, if user typed control Z. & 4040 GO SUB 13200 & \ WORK$ = SYS (PRT.QUE.STRING$) IF PRT.QUEABLE% & \ CLOSE #CH.PRT% & \ GO TO 1080 & ! Output the information, (queue it if necessary), & ! then return to the Sublist Menu. & & 5000 !-------------------------------------------------------------------- & ! & ! & ! Display & ! & ! & !-------------------------------------------------------------------- & & 5020 GO SUB 11700 & ! Go display the definition. & 5040 GO TO 1080 & ! Go back to the Sublist Menu. & & 7000 !-------------------------------------------------------------------- & ! & ! & ! Show All Sublists & ! & ! & !-------------------------------------------------------------------- & & 7100 GET #CH.ADD%, KEY #0% GT SUB.CHR$ +" " +"00001" & \ UNLOCK #CH.ADD% & \ GO TO 7190 UNLESS MLF.KEY0.TAG$ = SUB.CHR$ & \ NAM$ = MLF.SUBLIST.NAM$ & \ GO TO 7200 & ! Get the first sublist definition. & ! Trap to 7190 if the GET is unsuccessful (meaning there is nothing). & ! Also trap to 7190 if what is gotten is an address, meaning that & ! are no sublist definitions. & 7190 M11.MSG$ = "There are no sublist definitions for this Mailing List." & \ GO SUB 14900 & \ GO TO 1170 & ! Trap the case where there are no sublist definitions. & 7200 M11.MSG$ = "(This will clear any current sublist definition.)" & \ M11.MSG$ = "" IF M11.SUBLIST.CODE% = 0% & \ GO SUB 14900 IF M11.SUBLIST.CODE% <> 0% & \ GO TO 1100 IF F.END% & ! Put up heading information. & ! Go back to menu (without clearing existing def) if user typed ^Z. & 7300 M11.SUBLIST.NAME$ = NAM$ & \ GO SUB 12000 & \ GO SUB 11700 & \ GO TO 7900 IF F.END% & ! Go fill the sublist area. & ! Go display the definition. & 7600 GET #CH.ADD% & \ UNLOCK #CH.ADD% & \ GO TO 7900 IF MLF.KEY0.TAG$ <> SUB.CHR$ & \ GO TO 7600 IF MLF.SUBLIST.NAM$ = NAM$ & \ NAM$ = MLF.SUBLIST.NAM$ & \ GO TO 7300 & ! Get the next record. & ! If it's not a sublist record, then we're finished (go to main menu) & ! If it's just a continuation of the current sublist, try again. & ! Otherwise, it's a new sublist definition - go show it. & 7900 M11.LAST.LINE% = 0% & \ M11.SUBLIST.CODE% = 0% & \ SEL.ALL$ = "" & \ NAM$ = "" & \ M11.SUBLIST.NAME$ = "" & \ GO TO 1100 & ! Go back to the Sublist Menu. & & 9000 !*************************************************************** & ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !*************************************************************** & 9900 ERR.PROGNAM$ = ERR.CALLNAM$ & \ GOTO 32767 & ! Restore the caller's name as the current subprogram. & ! Goto the end of the subprogram. & & & & 10000 !******************************************************************** & ! & ! & ! Subroutines Local to this Program & ! & ! & !******************************************************************** & 10100 !-------------------------------------------------------------------- & ! & ! & ! Clear the Sublist Definition & ! & !-------------------------------------------------------------------- & ! & ! input: M11.SUBLIST.CODE% permanent or temporary & ! sublist & ! & ! output: M11.LAST.LINE% set to zero & ! SEL.ALL$ blanked out & ! & !-------------------------------------------------------------------- & 10120 M11.MSG$ = "Replacing the current sublist definition ..." & IF M11.SUBLIST.CODE% = PERM% & \ M11.MSG$ = "Replacing the existing temporary sublist definition..." & IF M11.SUBLIST.CODE% = TEMP% & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ SLEEP 3% & \ M11.LAST.LINE% = 0% & \ SEL.ALL$ = "" & \ RETURN & ! Clear the area of an existing sublist to prepare for a new sublist, & ! after informing the user. & 11700 !-------------------------------------------------------------------- & ! & ! & ! Display the Sublist Definition & ! & !-------------------------------------------------------------------- & ! & ! input: M11.LAST.LINE% the number of the last filled line & ! M11.MAIL.FILE$ the name of the Mailing List & ! NAM$ the name of the sublist & ! SEL.- the sublist definition variables & ! & ! local: LAST% last line of the sublist definition & ! I% for-next loop index & ! & !-------------------------------------------------------------------- & 11720 CALL M11SCW (ERASE.EOS$, 1%, 1%) & ! Blank out screen. & 11740 M11.MSG$ = "Sublist Definition" & \ CALL M11SCW (M11.MSG$, 1%, 30%) & \ CALL M11SCW ("Date: " + FN.DATE$(0%), 3%, 60%) & \ CALL M11SCW ("Time: " + FN.TIME$(0%), 4%, 60%) & \ CALL M11SCW ("Sublist name: " + NAM$, 3%, 1%) & \ CALL M11SCW ("Mailing List: " + M11.MAIL.FILE$, 4%, 1%) & & \ LAST% = M11.LAST.LINE% & \ LAST% = 16% IF M11.LAST.LINE% > 16% & \ CALL M11SCW (FN.DEPARSE$(I%), I%+5%, 1%) & FOR I% = 1% TO LAST% & \ M11.MSG$ = "When through reading the display ..." & \ GO SUB 14900 & ! Display the first half of the definition (with header). & 11760 RETURN IF M11.LAST.LINE% < 17% & ! Return to Sublist Menu, if that's all there is. & 11780 CALL M11SCW (ERASE.EOS$, 6%, 1%) & \ CALL M11SCW (FN.DEPARSE$(I%), I%-16%+5%, 1%) & FOR I% = 17% TO M11.LAST.LINE% & \ GO SUB 14900 & \ RETURN & ! Tell print/display to send to keyboard. & ! Blank the screen and go display information. & 13200 !-------------------------------------------------------------------- & ! & ! & ! Output a Sublist Definition & ! & !-------------------------------------------------------------------- & ! & ! & ! input: CH.PRT% output channel number & ! M11.MAIL.FILE$ name of the Mailing List & ! MAX.LINES% maximum number of lines in a def & ! SEL.- selection variables & ! NAM$ name of the sublist definition & ! & ! local: L% for-next loop variable & ! LINE$ output line to be printed & ! & !-------------------------------------------------------------------- & 13210 PRINT #CH.PRT%, LF+LF; SPACE$(30%); "Sublist Definition" & \ LINE$ = "Sublist name: " + NAM$ & \ LINE$ = LINE$ + SPACE$ (55% - LEN(LINE$)) & \ PRINT #CH.PRT%, LF+LF; LINE$; "Date: "; FN.DATE$(0%) & \ LINE$ = "Mailing List: " + M11.MAIL.FILE$ & \ LINE$ = LINE$ + SPACE$ (55% - LEN(LINE$)) & \ PRINT #CH.PRT%, LINE$; "Time: "; FN.TIME$(0%) & \ PRINT #CH.PRT%, LF+LF & ! Print out header. & 13220 PRINT #CH.PRT%, FN.DEPARSE$(L%) FOR L% = 1% TO M11.LAST.LINE% & ! Display each line of the definition. & 13290 PRINT #CH.PRT%, FF & \ RETURN & ! Include a Form Feed (for printouts). & & 15000 !*************************************************************** & ! & ! & ! F U N C T I O N S L O C A L T O & ! & ! T H I S S U B P R O G R A M & ! & ! & !*************************************************************** & 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. & 19300 RESUME 1260 IF ERL = 1255 AND (ERR = 11 OR ERR = 155) & \ RESUME 1255 IF ERL = 1255 AND ERR = 154 & \ RESUME 3085 IF ERL = 3080 AND (ERR = 155 OR ERR = 11 OR ERR = 154) & \ RESUME 7190 IF ERL = 7100 AND (ERR = 155 OR ERR = 11) & \ RESUME 7100 IF ERL = 7100 AND ERR = 154 & \ RESUME 7900 IF ERL = 7600 AND (ERR = 155 OR ERR = 11) & \ RESUME 7600 IF ERL = 7600 AND ERR = 154 & ! Handle expected errors: & ! Tried to get this sublist. & ! Trying to delete a record that does not exist. & ! We get here when the record we want to write doesn't exist. & ! Looking for more sublist records and don't find anything. & 19900 ERR.ERL% = ERL & \ ERR.ERR% = ERR & \ ERR.CODE% = FATAL.ERROR% & \ ERR.MSG$ = "Unexpected fatal error in M11SUB." & ! On a fatal error, set the standard error variables. & 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