1 SUB M11DSP & 2 !******************************************************************** & ! & ! & ! M11DSP & ! & ! Displays the Mailing List or Sublist & ! at the User's Terminal & ! & ! & !******************************************************************** & ! 3 ! Program : M11DSP & ! Version : 01 21-JUL-82 & ! Programmer : Don Gohn & ! Releaser : Jean Fullerton & ! & !--------------------------------------------------------------------- 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 prompts the user for the selection criteria & ! (that is: all, permanent sublist, or temporary sublist), asks & ! for a sort order (only primary or secondary key sorts are & ! available), and displays all addresses that meet the & ! criteria chosen. Fields displayed include: primary ID, & ! Alternate ID, name, state, and ZIP code. & ! & ! & !--------------------------------------------------------------------- 200 ! & ! & ! Interfaces: & ! & ! COMERR - Common Error buffer & ! COMCON - Common Constant buffer & ! COMVAR - Common Variable buffer & ! & ! MAPSCR - Screen buffer & ! MAPHDR - Mail file header buffer & ! MAPMLF - Address record buffer & ! MAPSUB - Sublist definition buffer & ! MAPADD - Unpacked address buffer & ! MAPSEL - Sublist definition array buffer & ! & ! & !--------------------------------------------------------------------- 300 ! & ! & ! Input / Output: & ! & ! & ! Channel Filename Map name Status at entry/exit & ! ------- --------- -------- -------------------- & ! CH.ADD% M11.MAIL.FILE$ MAPMLF OPEN/OPEN & ! CH.KB% "KB:" OPEN/OPEN & ! & !--------------------------------------------------------------------- 400 ! & ! & ! Variable and Array Definitions: & ! & ! & ! AND% Constant value for logical AND & ! ANS$ User keyboard response from M11SCR & ! CONTINUE$ "When through reading display" message & ! DEFAULT$ Default value passed to M11SCR & ! ERL Line in which error occurred & ! ERR Set to error number after error & ! F.END% Control Z was typed by user (M11SCR) & ! FIRST.PAGE% If true, display full heading before printing & ! labels & ! LINE.1$ Heading line 1 (Sublist name,Date) & ! LINE.2$ Heading line 2 (Mailing list name,Time) & ! LINE.3$ Heading line 3 (Sorted by:) & ! LINE.4$ Heading line 4 (Column headings) & ! LINES% Number of lines displayed on screen & ! MATCH% Logical value returned from SUBEXT (does & ! the address match the selection criteria & ! NAM$ Name of sublist selected by user & ! NAMES% Total number of addresses displayed & ! OR% Constant value for logical OR & ! REC$ Dynamic length buffer returned from M11UPK & ! SAV.PRIME.ID$ Variable to contain sublist def. record key & ! & !--------------------------------------------------------------------- 600 ! & ! COMMON Statements & ! & !--------------------------------------------------------------------- 650 !-------------------------------------------------------------------- & ! & ! MAP Statements & ! & !--------------------------------------------------------------------- 700 !-------------------------------------------------------------------- & ! & ! & ! Subprograms: & ! & ! Name Description & ! ---- ----------- & ! & ! M11SCD Forms display & ! M11SCW Screen write (writes one line to screen) & ! M11SCR Screen read (reads one field from screen) & ! M11UPK Upacks one address record and leaves in & ! MAPADD & ! & !-------------------------------------------------------------------- & ! 800 ! Subroutines: & ! & ! Line Number Description & ! ---- ------ ----------- & ! & ! 12000 (SUBLSD) Load sublist definition into memory & ! 12100 (SUBCNV) Convert sublist definition numeric and date & ! fields & ! 13500 (SUBEXT) Determine if address record meets selection & ! criteria & ! 14800 (SUBNOT) Print an informational message on the screen & ! 14900 (SUBERR) Print an error message on the screen & ! & ! & !-------------------------------------------------------------------- & ! & ! Functions: & ! & ! Name Description & ! ---- ----------- & ! & ! FN.DATE.CNV$ Convert a date from DD-MMM-YY to YYMMDD & ! FN.RJZF$ Right justify zero fill a numeric string & ! FN.DATE$ Return system date in dd-mmm-yy format & ! FN.TIME$ Return system time in hh:mm (military) format & ! & !-------------------------------------------------------------------- & 900 DIM TRUTH%(30%) ! One logical entry for each sublist def line & \ DIM AND.OR%(30%) ! AND or OR with the previous def line? & & 1000 !******************************************************************** & ! & ! & ! S T A R T P R O G R A M L O G I C & ! & ! & !******************************************************************** & 1010 ON ERROR GOTO 19000 & \ ERR.PROGNAM$ = "M11DSP VER:01" & \ ERR.SUBNAM$ = "" & \ ERR.MSG$ = "Unexpected fatal error" & \ PLEASE.WAIT$ = "The next address is in use by another user. Please wait." & ! Set standard error trap. Set up common for error reporting. & & 1040 AND% = 1% & \ OR% = 2% & \ CONTINUE$ = "When through reading the display ..." & ! Initialize constants. & 2000 !-------------------------------------------------------------------- & ! & ! Entire List or just sublist ? & ! & !-------------------------------------------------------------------- & 2100 CALL M11SCD (SCR.LIST.SELECT%) & ! Show the list selection choice. & 2120 CALL M11SCR (ANS$, 18%, 42%, 1%, "A", "A", F.END%) & \ GO TO 9000 IF F.END% & ! Get the answer, clear out if 'END'. & 2140 M11.LIST.CODE$ = ANS$ & \ GO TO 2200 IF POS("AST",ANS$,1%) > 0% & ! Save answer. Skip help message if valid response was entered. & 2190 CALL M11SCD (SCR.HLP.13%) & \ M11.MSG$ = " " & \ GO SUB 14900 & \ GO TO 2100 & ! Give help because answer not acceptable (including help requests) & 2200 GO TO 2300 UNLESS M11.LIST.CODE$ = "S" & \ DEFAULT$ = "" & \ DEFAULT$ = M11.SUBLIST.NAME$ IF M11.SUBLIST.CODE% = PERM% & \ CALL M11SCR (NAM$, 10%, 41%, 10%, DEFAULT$, "A", F.END%) & \ GO TO 2120 IF F.END% & \ GO TO 2190 IF NAM$ = "?" & \ IF NAM$ = "" & THEN IF M11.SUBLIST.CODE% = TEMP% & THEN GOSUB 12100 ! Convert numeric + date fields & \ GO TO 3000 & ELSE M11.MSG$ = "A temporary sublist does not currently exist." & \ GO TO 2290 & ELSE IF M11.SUBLIST.CODE% = PERM% AND NAM$ = M11.SUBLIST.NAME$ & THEN GOSUB 12100 ! Convert numeric + date fields & \ GO TO 3000 & ELSE SAV.PRIME.ID$ = SUB.CHR$ + SEG$ (NAM$ + SPACE$(10%), 1%,10%) & \ SUB.KEY0$ = SAV.PRIME.ID$ + "00001" & 2210 GET #CH.ADD%, KEY #0% EQ SUB.KEY0$ & 2220 M11.SUBLIST.CODE% = PERM% & \ M11.SUBLIST.NAME$ = NAM$ & \ GOSUB 12000 ! Load sublist definition & \ GOSUB 12100 ! Convert numeric + date fields & \ GO TO 3000 & ! If the answer is "sublist"... & ! Ask the user which one (the default is the current one, if any). & ! Unless the user picks the current one, send her back to main menu. & 2289 M11.MSG$ = "Sublist " + NAM$ + " does not currently exist." & ! Program traps back to here if the stored sublist does not exist. & 2290 CALL M11SCW (M11.MSG$, 23%, 1%) & \ M11.MSG$ = "Do you wish to go back to create that sublist definition (Y/N)?" & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ CALL M11SCR (ANS$, 24%, 66%, 1%, "Y", "Y", F.END%) & \ CALL M11SCW (ERASE.EOL$, 23%, 1%) & \ GO TO 2120 IF F.END% & \ IF ANS$ = "Y" & THEN ERR.CODE% = 10% & \ GO TO 9000 & ELSE GO TO 2120 & ! Handle the case where the user has requested a sublist that does & ! not exist (yet). & 2300 GO TO 3000 UNLESS M11.LIST.CODE$ = "T" & \ IF M11.SUBLIST.CODE% = TEMP% & THEN GOSUB 12100 & \ GO TO 3000 & ELSE M11.MSG$ = "A temporary sublist does not currently exist." & \ GO TO 2290 & ! If the temporary sublist was requested, check that it exists. If & ! it does, convert date and numeric fields. Otherwise, complain. & 3000 !-------------------------------------------------------------------- & ! & ! Sort Options & ! & !-------------------------------------------------------------------- & 3100 CALL M11SCD (SCR.DSP.SORT.MENU%) & ! Show the sort option menu. & 3120 CALL M11SCR (ANS$, 19%, 42%, 1%, "P", "A", F.END%) & \ GO TO 2000 IF F.END% & ! Get the answer, clear out if 'END'. & 3140 GO TO 3200 IF POS ("PA", ANS$, 1%) > 0% & ! Check for a proper answer. & 3190 CALL M11SCD (SCR.HLP.19%) & \ M11.MSG$ = " " & \ GO SUB 14900 & \ GO TO 3100 & ! Give help because answer not acceptable (including help requests). & 3200 M11.SORT.CODE$ = ANS$ & ! Save answer. & 3300 !-------------------------------------------------------------------- & ! & ! Any acceptable addresses ? & ! & !-------------------------------------------------------------------- & 3320 IF M11.SORT.CODE$ = "A" & THEN RESTORE #CH.ADD%, KEY #1% & ELSE RESTORE #CH.ADD%, KEY #0% & ! Start by determining and setting the access key. & 3330 IF M11.SORT.CODE$ = "A" & THEN GET #CH.ADD%, KEY #1% GE " " & ELSE GET #CH.ADD%, KEY #0% GT SUB.CHR$ + "zzzzzzzzzzzzzzz" & ! Then get the first name record (after any header records). & 3340 MOVE FROM #CH.ADD%, REC$ = RECOUNT & \ CALL M11UPK (REC$) & \ GO TO 4000 IF M11.LIST.CODE$ = "A" & \ GO SUB 13500 & \ GO TO 4000 IF MATCH% & 3350 GET #CH.ADD% & & \ GO TO 3340 & ! Loop thru the Mailing List File, until the first acceptable & ! address is found. & 3390 M11.MSG$ = "There are no addresses in this Mailing List File." & IF ERL = 3330 & \ M11.MSG$ = "There are no addresses that meet the sublist definition." & IF ERL = 3350 & \ GO SUB 14900 & \ GO TO 9000 IF M11.LIST.CODE$ = "A" & \ GO TO 2000 IF M11.LIST.CODE$ <> "A" & ! Warn the user that there is nothing to print. & ! Transfer to Main Menu if there is nothing at all; & ! transfer to the list selection if there is nothing in that sublist. & 3400 CALL M11SCW(PLEASE.WAIT$,24%,1%) & \ SLEEP 2% & \ GO TO 3330 & ! Handle a locked record at 3330. & 3420 CALL M11SCW(PLEASE.WAIT$,24%,1%) & \ SLEEP 2% & \ GO TO 3350 & ! Handle a locked record at 3350. & 4000 !-------------------------------------------------------------------- & ! & ! & ! Display Information & ! & ! & !-------------------------------------------------------------------- & 4020 M11.MSG$ = "working ... please wait" & \ GO SUB 14800 & ! Notify the user to wait. & 4040 LINE.1$ = "" & \ LINE.1$ = "Sublist name: " + M11.SUBLIST.NAME$ & IF M11.LIST.CODE$ = "T" OR M11.LIST.CODE$ = "S" & \ LINE.2$ = "Mailing List: " + EDIT$(M11.MAIL.FILE$,128%) & \ LINE.3$ = "Sorted by: Primary ID" & \ LINE.3$ = "Sorted by: Alternate ID" IF M11.SORT.CODE$ = "A" & \ NAMES% = 0% & \ FIRST.PAGE% = TRUE% & ! Initialize heading information. & 4100 !-------------------------------------------------------------------- & ! & ! Display Information - Short & ! & !-------------------------------------------------------------------- & & 4120 CALL M11SCW(ERASE.EOS$,1%,1%) & \ LINES% = 0% & \ GO TO 4160 IF NOT FIRST.PAGE% & \ LINE.1$ = LINE.1$ + SPACE$(64% -LEN(LINE.1$)) +"Date: "+FN.DATE$(0%) & \ LINE.2$ = LINE.2$ + SPACE$(64% -LEN(LINE.2$)) +"Time: "+FN.TIME$(0%) & \ LINE.4$ = "Primary ID Alter. ID Name State ZIP Code" & ! Initialize heading information. & 4140 CALL M11SCW(SPACE$(28%) + "Short Address Listing",2%,1%) & \ CALL M11SCW(LINE.1$,4%,1%) & \ CALL M11SCW(LINE.2$,5%,1%) & \ CALL M11SCW(LINE.3$,6%,1%) & \ FIRST.PAGE% = FALSE% & \ LINES% = LINES% + 8% & 4160 LINES% = LINES% + 1% & \ CALL M11SCW(LINE.4$,LINES%,1%) & \ CALL M11SCW( "---------------- ---------- ----------------------------- ----------- ----------",(LINES% + 1%),1%) & \ LINES% = LINES% + 3% & ! Print out heading on each page. & 4180 CALL M11SCW((ADD.PRIME.ID$ + " " + ADD.ALTERNATE.ID$ + " " + & ADD.NAME$ + ADD.STATE$ + ADD.ZIP$),LINES%,1%) & \ NAMES% = NAMES% + 1% & \ LINES% = LINES% + 1% & ! Print address record contents. & 4200 GET #CH.ADD% & ! Get next record. & 4210 MOVE FROM #CH.ADD%, REC$ = RECOUNT & \ CALL M11UPK (REC$) & \ GO TO 4220 IF M11.LIST.CODE$ = "A" & \ GO SUB 13500 & \ GO TO 4200 UNLESS MATCH% & ! If it matches the sublist definition then go print it out (with or & ! without a new page and header). & ! If it does not match, then go get another record. & 4220 IF LINES% < 23% THEN GO TO 4180 & ELSE UNLOCK #CH.ADD% & \ M11.MSG$ = CONTINUE$ & \ GO SUB 14900 & \ GO TO 2000 IF F.END% & \ GO TO 4120 & ! If the user types CNTRL Z, then go back to the 'all or sublist' & ! menu. & 4240 CALL M11SCW(PLEASE.WAIT$,24%,1%) & \ SLEEP 2% & \ GO TO 4200 & ! Handle a locked record at 4200. & 4300 !-------------------------------------------------------------------- & ! & ! Display Total & ! & !-------------------------------------------------------------------- & & 4320 GO TO 4340 IF LINES% < 20% & \ M11.MSG$ = CONTINUE$ & \ GO SUB 14900 & \ CALL M11SCW (ERASE.EOS$, 1%, 1%) & 4340 M11.MSG$ ="task completed, total selected addresses ="+STR$(NAMES%) & \ CALL M11SCW (M11.MSG$, 21%, 1%) & \ IF LINES% >= 20% & THEN SLEEP 3% & ELSE M11.MSG$ = CONTINUE$ & \ GO SUB 14900 & ! Print total addresses selected and notify the user that task is & ! done. & & 9000 !******************************************************************** & ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !******************************************************************** & 9990 UNLOCK #CH.ADD% & \ ERR.PROGNAM$ = ERR.CALLNAM$ & \ GO TO 32767 & ! Reopen the keyboard in echo control mode. If there were any & ! numeric or date fields converted in the sublist definition, then & ! we have to go get it again. Jump around the junk and leave. & 10000 !*************************************************************** & ! & ! & ! S U B R O U T I N E S L O C A L T O & ! & ! T H I S P R O G R A M & ! & ! & !*************************************************************** & 12000 ! SUBLSD.120 will be appended here at compile time. & 12100 ! SUBCNV.121 will be appended here at compile time. & 13500 ! SUBEXT.135 will be appended here at compile time. & 14900 ! SUBERR.149 will be appended here at compile time. & 15000 !*************************************************************** & ! & ! & ! F U N C T I O N S L O C A L T O & ! & ! T H I S P R O G R A M & ! & ! & !*************************************************************** & 15600 ! FNDCNV.156 will be appended here at compile time. & 16000 ! FNRJZF.160 will be appended here at compile time. & & 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% AND (ERL = 3330% OR ERL = 3350% OR ERL = 4200%) & THEN RESUME 3400 IF ERL = 3330% & \ RESUME 3420 IF ERL = 3350% & \ RESUME 4240 IF ERL = 4200% & ! Handle record locking for addresses. & 19200 RESUME 3390 IF ERL = 3330 AND ERR = 11 ! eof & \ RESUME 3390 IF ERL = 3330 AND ERR = 155 ! not on file & \ RESUME 3390 IF ERL = 3350 AND ERR = 11 ! eof & \ RESUME 3390 IF ERL = 3350 AND ERR = 155 ! not on file & \ RESUME 4300 IF ERL = 4200 AND ERR = 11 ! eof & \ RESUME 2210 IF ERL = 2210 AND ERR = 154 ! locked & \ RESUME 2289 IF ERL = 2210 AND ERR = 11 ! eof & \ RESUME 2289 IF ERL = 2210 AND ERR = 155 ! not on file & ! Handle expected error traps. & 19900 ERR.ERL% = ERL & \ ERR.ERR% = ERR & \ ERR.CODE% = FATAL.ERROR% & ! On fatal error, set the error code. & 19990 ON ERROR GO BACK & ! Return to calling program for fatal error processing. & & & 32767 SUBEND & &