1 SUB M11SUP & 2 !******************************************************************** & ! & ! & ! M11SUP & ! & ! Updates the sublist definitions & ! & ! & !******************************************************************** & ! 3 ! Subprogram : M11SUP & ! Version : 1 24-Jan-82 & ! Programmer : Jean Fullerton & ! Releaser : Don Gohn & ! & ! & !-------------------------------------------------------------------- 11 ! & ! C O P Y R I G H T & ! & !-------------------------------------------------------------------- 100 ! & ! Summary & ! & ! This subprogram handles the sublist definition modification. & ! The subprogram is called from MAIL11 after a call to M11SUB returns & ! with the UPDATE% flag set (indicating that the user wants to create & ! a new sublist definition or update an old one). & ! & ! & ! Assumptions: & ! & ! * 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 & ! & ! & ! Arguments: & ! & ! none & ! & ! & !--------------------------------------------------------------------- 300 ! & ! & ! Input / Output & ! & ! & ! Channel Filename Map name Status at entry/exit & ! ------- --------- -------- -------------------- & ! CH.ADD - MAPMLF open / open & ! 400 !-------------------------------------------------------------------- & ! & ! Variable and Array Definitions & ! & ! & ! & ! & ! ANS$ User's response to prompt & ! ANS% User's response to numeric prompt & ! ANS.TYPE$ Type of answer expected & ! BASE% Offset to screen line & ! CAT% Category index & ! CLINE% Current line number in definition for updating & ! CLINE$ string representation of CLINE% & ! COMP$ Description of comparison type & ! DEFAULT$ Default answer & ! ERL Line in which error occurred & ! ERR Set to error number after error & ! F.END% Set to TRUE if user typed CTRL/Z & ! FIELD.NUM% Number of the field on which to compare & ! FLINE% Number of the first line to display & ! L% For-next loop variable & ! LABEL$ Labels of the fields on which to compare & ! LINE% Number of line in definition & ! LINE$ Sublist line translated to English & ! LINE.IN.REC% Position of line within sublist definition record & ! LOC% Horizontal position on screen for answer & ! NAM$ Name of the sublist definition & ! R% Index of relative line on screen & ! RLINE% Relative position of line on screen & ! S.ACTUAL.REC% Number of the actual record within the sublist & ! SAV.PRIME.ID$ Prefix of Primary key for sublist records & ! WORK$ Intermediate working variable & ! XLINE% Line index & ! 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 & ! & ! 12500 Write sublist definition to file & ! 12700 Write sublist record to file & ! 13000 Display the Sublist definition screen & ! 14800 Notify user of status & ! 14900 Handle error message & ! & !-------------------------------------------------------------------- & ! & ! Functions & ! & ! FN.DATE.CNV$ 15600 Converts a date from DD-MMM-YY to YYMMDD & ! FN.DEPARSE$ 15800 Parses a sublist definition & ! 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$ = "M11SUP VER:01" ! Set up our name. & \ ERR.SUBNAM$ = "" & & \ NAM$ = EDIT$ (M11.SUBLIST.NAME$,128%) ! Get sublist name without & ! trailing blanks & \ SAV.PRIME.ID$ = SUB.CHR$ + SEG$ (NAM$ + SPACE$(10%), 1%, 10%) & ! Get key for 1st sublist rec & & \ 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" & ! Set standard error trap. & ! Set up COMMON for error reporting. & ! Initialize labels and comparisons. & 2000 !-------------------------------------------------------------------- & ! & ! & ! Update & ! & ! & !-------------------------------------------------------------------- & & 2030 BASE% = 14% ! Offset on screen & \ FLINE% = 1% ! Number of first line displayed & \ RLINE% = 1% ! Relative position of current line & ! in the display area. & ! Initialize offset and line pointers. & 2040 GO SUB 13000 & ! Put up the basic sublist definition screen. & 2050 !-------------------------------------------------------------------- & ! line number & !-------------------------------------------------------------------- & 2060 CLINE% = M11.LAST.LINE% + 1% & \ CLINE% = MAX.LINES% IF CLINE% > MAX.LINES% & \ CLINE$ = NUM1$ (CLINE%) & \ GO TO 2100 IF CLINE% = 1% & ! (Re)set the default current line number. & ! Skip over the next sections if there aren't any existing lines. & 2065 M11.MSG$ = "Select the number of the line to add/update/remove:" & \ CALL M11SCW (M11.MSG$, 22%, 11%) & \ M11.MSG$ = "(or type END to terminate the definition)" & \ CALL M11SCW (M11.MSG$, 23%, 11%) & ! Ask line question. & 2066 CALL M11SCR (ANS$, 22%, 64%, 2%, CLINE$, "N", F.END%) & \ CALL M11SCW (ERASE.EOL$, 23%, 11%) & \ GO TO 2900 IF F.END% & \ GO TO 2069 IF ANS$ = "?" ! help & \ ANS% = VAL (ANS$) & \ GO TO 2069 IF ANS% < 1% OR ANS% > CLINE% ! error & \ CLINE% = ANS% & \ GO TO 2070 & ! Read and check the line number. & ! Set the current line pointer. & 2069 M11.MSG$ = "Type number of line to add/change/remove (next is " + CLINE$ + ") or type END." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 2066 & ! Provide assistance. & 2070 IF CLINE% > FLINE% + 5% ! requested line beyond limit & OR CLINE% < FLINE% ! requested line before limit & THEN FLINE% = CLINE% - 5% & \ FLINE% = 1% IF FLINE% < 1% & \ FOR R% = 1% TO 6% & \ L% = R% + FLINE% - 1% & \ CALL M11SCW (FN.DEPARSE$(L%), BASE% + R%, 1%) & \ NEXT R% & ! Scroll the display area if outside the limits. & 2074 RLINE% = CLINE% - FLINE% + 1% & ! Define the relative line position within the display area. & 2075 !-------------------------------------------------------------------- & ! remove a line ? & !-------------------------------------------------------------------- & 2077 GO TO 2100 IF CLINE% = M11.LAST.LINE% + 1% & ! If the user requested the next line (=last+1), then this must be & ! an add operation and this section of code should be bypassed. & ! Otherwise, it could be a remove or a change. & 2080 GO TO 2100 IF M11.LAST.LINE% = 1% & \ M11.MSG$ = "Type REMOVE to remove the line; or press RETURN to update it:" & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ CALL M11SCR (ANS$, 24%, 64%, 6%, "", "A", F.END%) & \ GO TO 2050 IF F.END% & \ GO TO 2090 IF ANS$ = "?" & \ GO TO 2100 UNLESS ANS$ = "REMOVE" & ! Assume that this is an update if this is the only line. & ! (In other words, do not allow them to REMOVE a sublist def.) & ! Check which operation the user wishes to perform. & ! Check for exceptional answers. & ! Go on to update if the answer is anything but REMOVE. & 2082 CALL M11SCW (ERASE.EOL$, BASE% + RLINE%, 11%) & \ SLEEP 2% & ! Erase the removed line. & ! Pause to show the user, before bubbling up the next lines. & 2084 FOR L% = CLINE% TO M11.LAST.LINE% - 1% & \ SEL.FIELD.NUM$(L%) = SEL.FIELD.NUM$(L%+1%) & \ SEL.PR.CODE$(L%) = SEL.PR.CODE$(L%+1%) & \ SEL.OP.CODE$(L%) = SEL.OP.CODE$(L%+1%) & \ SEL.ACC.REJ$(L%) = SEL.ACC.REJ$(L%+1%) & !* SEL.FUTURE$(L%) = SEL.FUTURE$(L%+1%) & \ SEL.VALUE.1$(L%) = SEL.VALUE.1$(L%+1%) & \ SEL.VALUE.2$(L%) = SEL.VALUE.2$(L%+1%) & \ NEXT L% & \ SEL.FIELD.NUM$(M11.LAST.LINE%) = "" & \ SEL.PR.CODE$(M11.LAST.LINE%) = "" & \ SEL.OP.CODE$(M11.LAST.LINE%) = "" & \ SEL.ACC.REJ$(M11.LAST.LINE%) = "" & !* SEL.FUTURE$(M11.LAST.LINE%) = "" & \ SEL.VALUE.1$(M11.LAST.LINE%) = "" & \ SEL.VALUE.2$(M11.LAST.LINE%) = "" & \ M11.LAST.LINE% = M11.LAST.LINE% - 1% & \ CLINE% = M11.LAST.LINE% & ! Bubble up the lines to fill in the deleted line. Change current & ! to M11.LAST.LINE%, to indicate that no new line was added. & 2086 FOR R% = RLINE% TO 6% & \ L% = R% + FLINE% - 1% & \ CALL M11SCW (FN.DEPARSE$ (L%), BASE% + R%, 1%) & \ NEXT R% & \ GO TO 2800 & ! Redisplay the display area after the removal. & ! Go back for the next line. & 2090 M11.MSG$ = "Type REMOVE to erase the line; press RETURN to change the line; type END to backup." & \ GO SUB 14900 & \ GO TO 2080 & ! Define the relative line position within the display area. & & 2100 !-------------------------------------------------------------------- & ! connector code & !-------------------------------------------------------------------- & 2110 CLINE$ = NUM1$(CLINE%) & \ LINE$ = "line " + CLINE$ + ": " IF CLINE% < 10% & \ LINE$ = "line " + CLINE$ + ": " IF CLINE% >= 10% & \ IF CLINE% = 1% THEN SEL.PR.CODE$(CLINE%) = " " & \ LINE$ = LINE$ + " " & \ GO TO 2200 & ! Build this part of the display line. & ! Handle the first line as a separate case (ie, no connector code). & 2120 M11.MSG$ = "Select a word to connect to the next line (AND/OR):" & \ CALL M11SCW (M11.MSG$, 22%, 11%) & ! Ask the question. & 2130 DEFAULT$ = "and" & \ DEFAULT$ = " or" IF SEL.PR.CODE$(CLINE%) = "1" & ! Set up default answer. & 2140 CALL M11SCR (ANS$, 22%, 64%, 3%, DEFAULT$, "A", F.END%) & !** GO TO 2100 IF F.END% & \ GO TO 2065 IF F.END% & \ LSET ANS$ = ANS$ & ! Request a connecting operator. & ! If END is typed allow user to escape back to line number prompt. 2160 IF ANS$ = "?" OR (ANS$ <> "AND" AND ANS$ <> "OR") THEN & M11.MSG$ = "Type 'AND' for BOTH lines to be true; 'OR' for EITHER line." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 2140 & ! Get option. If end, go rewrite. & 2180 IF ANS$ = "OR " & THEN SEL.PR.CODE$(CLINE%) = "1" & \ LINE$ = LINE$ + " or " & ELSE SEL.PR.CODE$(CLINE%) = "2" & \ LINE$ = LINE$ + "and " & ! Build the next part of the display line. & 2190 CALL M11SCW (LINE$, BASE% + RLINE%, 1%) & ! Show user what was chosen. & 2200 !-------------------------------------------------------------------- & ! field name & !-------------------------------------------------------------------- & 2220 M11.MSG$ = "Select a FIELD NAME (1-16):" & \ CALL M11SCW (M11.MSG$, 22%, 11%) & ! Ask the first question. & 2230 DEFAULT$ = "" & \ DEFAULT$ = SEL.FIELD.NUM$(CLINE%) & IF SEL.ACC.REJ$(CLINE%) <> "" & ! Set up default answer. & 2240 CALL M11SCR (ANS$, 22%, 40%, 2%, DEFAULT$, "N", F.END%) & \ IF F.END% & THEN & \ IF M11.NEW.SUBLIST% AND CLINE% = 1% & THEN & \ SEL.ALL$ = "" & \ NAM$ = "" & \ M11.SUBLIST.NAME$ = "" & \ M11.SUBLIST.CODE% = 0% & \ M11.LAST.LINE% = 0% & \ GO TO 9000 & ELSE & \ GOTO 2050 IF CLINE% <> M11.LAST.LINE% + 1% & \ CALL M11SCW (ERASE.EOL$, BASE% + RLINE%, 1%) & \ SEL.PR.CODE$( CLINE% ) = "" & \ GO TO 2065 & ! Request a field name to compare. If END is typed and this is the & ! first line of a new sublist, then allow user to escape back to & ! main menu. & ! & ! Otherwise, if END is typed, erase display line and reprompt for & ! line to add/change/remove & 2250 IF ANS$ = "?" THEN & CALL M11SCD (SCR.HLP.12%) & \ M11.MSG$ = " " & \ GO SUB 14900 & \ GO TO 2000 & ! Show help screen. & 2260 IF ANS$ = "" & OR POS ("\1\2\3\4\5\6\7\8\9\10\11\12\13\14\15\16","\"+ANS$,1%) = 0% & THEN M11.MSG$ = "Type the number of the field you wish to select (from 1 to 16)" & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 2240 & ! Get option. If end, go rewrite. & 2280 SEL.FIELD.NUM$(CLINE%) = ANS$ & \ ANS% = VAL (ANS$) & ! Remember field number. & 2290 LINE$ = LINE$ + LABEL$(ANS%) & \ CALL M11SCW (LINE$, BASE% + RLINE%, 1%) & ! Build more display line and show user what was chosen. & & !-------------------------------------------------------------------- & ! comparison code & !-------------------------------------------------------------------- & 2320 M11.MSG$ = "Select a COMPARISON (a-h):" & \ CALL M11SCW (M11.MSG$, 22%, 11%) & ! Ask the next question. & 2330 DEFAULT$ = "a" & \ DEFAULT$ = CHR$ (97% + (VAL(SEL.OP.CODE$(CLINE%))-1%) *2% ) & IF SEL.ACC.REJ$(CLINE%) = "A" & \ DEFAULT$ = CHR$ (98% + (VAL(SEL.OP.CODE$(CLINE%))-1%) *2% ) & IF SEL.ACC.REJ$(CLINE%) = "R" & ! Set up default answer. & ! Calculate the default op code letter based on a = CHR$(97%) ... & 2340 CALL M11SCR (ANS$, 22%, 40%, 1%, DEFAULT$, "A", F.END%) & \ IF F.END% & THEN & \ GOTO 2050 IF CLINE% <> M11.LAST.LINE% + 1% & \ CALL M11SCW( ERASE.EOL$, BASE% + RLINE%, 1%) & \ SEL.PR.CODE$( CLINE% ) = "" & \ SEL.FIELD.NUM$( CLINE% ) = "" & \ GO TO 2065 & ! Request a comparison type. & ! If END is typed erase display line and reprompt for & ! for line to add/change/remove. & 2360 IF ANS$ = "?" OR ANS$ < "A" OR ANS$ > "H" & OR LEN(ANS$) > 1% THEN & M11.MSG$ = "Type comparison code letter to compare field to value (a to h)." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 2340 & ! Check answer. & ! Provide help or correction, if needed. & 2370 ANS% = ASCII (ANS$) - 64% & \ IF ANS% = 1% OR ANS% = 3% OR ANS% = 5% OR ANS% = 7% & THEN SEL.OP.CODE$(CLINE%) = NUM1$ ((ANS%+1%)/2%) & \ SEL.ACC.REJ$(CLINE%) = "A" & ELSE SEL.OP.CODE$(CLINE%) = NUM1$ (ANS%/2%) & \ SEL.ACC.REJ$(CLINE%) = "R" & ! Set the stored values, based on the chosen operation. & 2380 LINE$ = LINE$ + " " + COMP$(ANS%) & \ CALL M11SCW (LINE$, BASE% + RLINE%, 1%) & ! Show user what was chosen. & 2390 IF (DEFAULT$ = "g" OR DEFAULT$ = "h") AND ANS$ < "G" THEN & CALL M11SCW (ERASE.EOL$, BASE% + RLINE%, 58%) & \ SEL.VALUE.2$(CLINE%) = "" & ! Wipe out the second value if this line was changed from a "between" & ! type of comparison to a straight comparison. & & !-------------------------------------------------------------------- & ! value 1 & !-------------------------------------------------------------------- & 2520 IF ANS% < 7% & THEN M11.MSG$ = "Specify a value for comparison:" & \ CALL M11SCW (M11.MSG$, 22%, 11%) & \ LOC% = 44% & ELSE M11.MSG$ = "Specify the FIRST value in the range:" & \ CALL M11SCW (M11.MSG$, 22%, 11%) & \ LOC% = 50% & ! Ask the next question. & 2530 FIELD.NUM% = VAL (SEL.FIELD.NUM$(CLINE%)) & \ ANS.TYPE$ = "A" & \ ANS.TYPE$ = "N" IF FIELD.NUM% = 3% & OR (HDR.SYS.DEF.PRIME.ID$ = "Y" AND FIELD.NUM% = 1%) & OR (HDR.SYS.DEF.PRIME.ID$ = "1" AND FIELD.NUM% = 1%) & \ ANS.TYPE$ = HDR.CAT.TYPE$(FIELD.NUM% - 4%) IF FIELD.NUM% > 4% & AND FIELD.NUM% < 11% & \ DEFAULT$ = SEL.VALUE.1$(CLINE%) & \ A.LEN% = 10% & \ A.LEN% = 16% IF FIELD.NUM% = 1% & \ A.LEN% = 4% IF FIELD.NUM% = 3% & \ A.LEN% = 16% IF FIELD.NUM% > 10% & AND FIELD.NUM% < 16% & \ A.LEN% = 12% IF FIELD.NUM% = 16% & \ A.LEN% = 9% IF ANS.TYPE$ = "D" & \ A.LEN% = 1% IF ANS.TYPE$ = "Y" & ! The type is numeric if it is the counter, or a system-defined & ! primary ID. The type is picked from the header if its a category. & ! Otherwise, every other field is alphanumeric. & ! Set up the default answer. & 2540 CALL M11SCR (ANS$, 22%, LOC%, A.LEN%, DEFAULT$, ANS.TYPE$, F.END%) & \ IF F.END% & THEN & \ GOTO 2050 IF CLINE% <> M11.LAST.LINE% + 1% & \ CALL M11SCW( ERASE.EOL$, BASE% + RLINE%, 1% ) & \ SEL.PR.CODE$( CLINE% ) = "" & \ SEL.FIELD.NUM$( CLINE% ) = "" & \ SEL.OP.CODE$( CLINE% ) = "" & \ SEL.ACC.REJ$(CLINE%) = "" & \ GO TO 2065 & ! Request a comparison value. & ! If END is typed erase display line and reprompt for & ! for line to add/change/remove. & 2560 IF ANS$ = "?" & OR (ANS$ = "" AND ANS.TYPE$ <> "A") & THEN M11.MSG$ = "Type in a value against which to compare." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 2540 & ! Check answer. Allow null answer for type A only. & ! Provide help or correction, if needed. & 2580 SEL.VALUE.1$(CLINE%) = ANS$ & \ LINE$ = LINE$ + " " + SEL.VALUE.1$(CLINE%) & \ LINE$ = LINE$ + " " UNTIL LEN(LINE$) => 46% & \ CALL M11SCW (LINE$, BASE% + RLINE%, 1%) & ! Store the answer as is. & ! Show user what was chosen. & & !-------------------------------------------------------------------- & ! value 2 & !-------------------------------------------------------------------- & 2610 GO TO 2800 IF ANS% < 7% & ! Bypass a second value unless this is a "between" comparison. & 2620 M11.MSG$ = "Specify the LAST value in the range:" & \ CALL M11SCW (M11.MSG$, 22%, 11%) & \ LOC% = 50% & \ DEFAULT$ = SEL.VALUE.2$(CLINE%) & ! Ask for the upper limit. & ! Set up the default answer. & 2640 CALL M11SCR (ANS$, 22%, LOC%, A.LEN%, DEFAULT$, ANS.TYPE$, F.END%) & \ IF F.END% & THEN & \ GOTO 2050 IF CLINE% <> M11.LAST.LINE% + 1% & \ CALL M11SCW( ERASE.EOL$, BASE% + RLINE%, 1% ) & \ SEL.PR.CODE$( CLINE% ) = "" & \ SEL.FIELD.NUM$( CLINE% ) = "" & \ SEL.OP.CODE$( CLINE% ) = "" & \ SEL.ACC.REJ$(CLINE%) = "" & \ SEL.VALUE.1$(CLINE%) = "" & \ GO TO 2065 & ! Request the second comparison value. & ! If END is typed erase display line and reprompt for & ! for line to add/change/remove. & 2660 IF ANS$ = "?" & OR (ANS$ = "" AND ANS.TYPE$ <> "A") & THEN M11.MSG$ = "Type in upper limit of range against which to compare." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 2640 & ! Check answer. Allow null answer for type A, but not N, D, Y or C. & ! Provide help or correction, if needed. & 2680 SEL.VALUE.2$(CLINE%) = ANS$ & \ LINE$ = LINE$ + " and " + SEL.VALUE.2$(CLINE%) & \ CALL M11SCW (LINE$, BASE% + RLINE%, 1%) & ! Store the answer as is. & ! Show user what was chosen. & 2685 GOTO 2690 UNLESS ANS.TYPE$ = "C" ! Check 'between' values for Coded category type. V1$ = EDIT$ (SEL.VALUE.1$(CLINE%), 128% ) V2$ = EDIT$ (SEL.VALUE.2$(CLINE%), 128% ) IF LEN (V1$) <> LEN (V2$) THEN M11.MSG$ = "Coded comparison strings should be same length." GOSUB 14900 GOTO 2840 END IF ! Comparison strings should be the same length for valid ! 'between' comparisons. FOR CHAR% = 1% TO LEN (SEL.VALUE.1$(CLINE%)) C1$ = SEG$ (SEL.VALUE.1$(CLINE%), CHAR%, CHAR%) C2$ = SEG$ (SEL.VALUE.2$(CLINE%), CHAR%, CHAR%) IF (C1$ = PRM.WILDCARD.CHR$ AND C2$ <> PRM.WILDCARD.CHR$ ) & OR (C2$ = PRM.WILDCARD.CHR$ AND C1$ <> PRM.WILDCARD.CHR$ ) THEN M11.MSG$ = "Wildcard charcters are not in matching positions." GOSUB 14900 GOTO 2840 END IF ! Wildcard characters must be in matching positions for ! valid 'between' comparisons. IF C1$ <> PRM.WILDCARD.CHR$ AND C1$ > C2$ THEN M11.MSG$ = "That restriction cannot be met for coded fields." GOSUB 14900 GOTO 2840 END IF ! Every character in 2nd comparison string must be higher than, or ! equal to, the corresponding character in the first comparison ! string. NEXT CHAR% GOTO 2840 ! Skip over tests for other category types. 2690 M11.MSG$ = "That restriction can not be met. (Try reversing the values.)" & \ IF ANS.TYPE$ = "D" & THEN GO SUB 14900 IF FN.DATE.CNV$ (SEL.VALUE.1$(CLINE%)) > & FN.DATE.CNV$ (SEL.VALUE.2$(CLINE%)) & \ GO TO 2800 & ELSE IF ANS.TYPE$ = "N" & THEN GO SUB 14900 IF VAL (SEL.VALUE.1$(CLINE%)) > & VAL (SEL.VALUE.2$(CLINE%)) & \ GO TO 2800 & ELSE GO SUB 14900 IF SEL.VALUE.1$(CLINE%) > & SEL.VALUE.2$(CLINE%) & ! Check that a < b on 'between' comparisons. & & 2800 !-------------------------------------------------------------------- & ! Reset and Check & !-------------------------------------------------------------------- & 2820 IF CLINE% > 1% THEN & & IF SEL.OP.CODE$(CLINE%) = "1" AND SEL.ACC.REJ$(CLINE%) = "A" & AND SEL.OP.CODE$(CLINE%-1%) = "1" AND SEL.ACC.REJ$(CLINE%-1%) = "A" & AND SEL.PR.CODE$(CLINE%) = "2" & AND SEL.FIELD.NUM$(CLINE%) = SEL.FIELD.NUM$(CLINE%-1%) & AND SEL.VALUE.1$(CLINE%) <> SEL.VALUE.1$(CLINE%-1%) & THEN M11.MSG$ = "No address can meet these restrictions. (Try OR instead of AND)" & \ GO SUB 14900 & ! Check for a requirement that the same field equal different values. & ! Warn user that this will generate a null sublist. & 2840 SEL.FUTURE$(CLINE%) = " " & \ M11.LAST.LINE% = CLINE% IF CLINE% > M11.LAST.LINE% & \ GO TO 2050 & ! When done, reset counter and go back to the first question. & 2900 !-------------------------------------------------------------------- & ! Store and Continue & !-------------------------------------------------------------------- & 2920 IF M11.LAST.LINE% = 0% THEN M11.SUBLIST.CODE% = 0% & \ GO TO 9000 & ! Handle a null list. There is now no default sublist definition. & 2940 GO SUB 12500 UNLESS NAM$ = "TEMPORARY" & ! (Re)store sublist if it is permenant (even if no changes were made) & ! Return 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 & ! & ! & !******************************************************************** & 12500 !-------------------------------------------------------------------- & ! & ! & ! Write Sublist Definition to file & ! & !-------------------------------------------------------------------- & ! & ! & ! input: SEL.- the sublist definition variables & ! M11.LAST.LINE% last line in the definition & ! & ! output: Mailing List File sublist records & ! & ! local: LINE.IN.REC% sublist line in sublist record & ! S.ACTUAL.REC% number of the record to be written & ! XLINE% for-next loop index & ! SUB.LINE$ sublist line & ! & ! assumptions: & ! & ! * The calling routine checks for a null list. & ! & ! & !-------------------------------------------------------------------- & 12520 LINE.IN.REC% = 0% & \ S.ACTUAL.REC% = 0% & \ FOR XLINE% = 1% TO M11.LAST.LINE% & ! Start the loop. & 12540 SUB.LINE$(LINE.IN.REC%) = SEL.FIELD.NUM$(XLINE%) & + SEL.PR.CODE$(XLINE%) & + SEL.OP.CODE$(XLINE%) & + SEL.ACC.REJ$(XLINE%) & + SEL.FUTURE$(XLINE%) & + SEL.VALUE.1$(XLINE%) & + SEL.VALUE.2$(XLINE%) & 12550 IF LINE.IN.REC% < 7% & THEN LINE.IN.REC% = LINE.IN.REC% + 1% & ELSE LINE.IN.REC% = 0% & \ GO SUB 12700 ! Write to next record. & ! Full entries get written to file. & 12580 NEXT XLINE% & 12590 LSET SUB.LINE$(LINE.IN.REC%) = "END" & \ GOSUB 12700 & \ RETURN & ! When done, write last record & get out. & & 12700 !-------------------------------------------------------------------- & ! & ! & ! Write a Sublist Record to the File & ! & !-------------------------------------------------------------------- & ! & ! input: S.ACTUAL.REC% number of the record to be written & ! SUB.ALL$ sublist definition & ! SAV.PRIME.ID$ prefix for Primary ID for sublist & ! & ! output: S.ACTUAL.REC% number of the next record to be writ & ! MLF.ALL$ Mailing List file record & ! & ! local: SLEN% length of sublist & ! Z9% working variable & ! & ! assumption: no more than 9 sublist records for any sublist & !-------------------------------------------------------------------- & 12720 S.ACTUAL.REC% = S.ACTUAL.REC% + 1% & \ Z9$ = "0000" + NUM1$ (S.ACTUAL.REC%) & \ SUB.KEY0$ = SAV.PRIME.ID$ + Z9$ & \ SLEN% = LEN(SUB.ALL$) & ! Make the next key for writing. & 12730 FIND #CH.ADD%, KEY #0% EQ SUB.KEY0$ & ! If the FIND is not successful, resume at 12750. & 12740 \ MLF.ALL$ = SUB.ALL$ & \ UPDATE #CH.ADD%, COUNT SLEN% & \ RETURN & ! If this record existed, then "UPDATE". & 12750 \ MLF.ALL$ = SUB.ALL$ & \ PUT #CH.ADD%, COUNT SLEN% & \ RETURN & ! Record did not exist - 'PUT' it to the file. & 13000 !-------------------------------------------------------------------- & ! & ! & ! Display the Sublist Definition screen & ! & !-------------------------------------------------------------------- & ! & ! input: NAM$ name of the sublist & ! FLINE% number of the first line to display & ! SEL.- the sublist definition variables & ! & ! output: sublist definition to the user's screen & ! RLINE% relative line with screen display & ! & ! local: BASE% screen line offset & ! CAT% for-next loop variable & ! LINE% for-next loop offset & ! & !-------------------------------------------------------------------- & 13010 CALL M11SCD (SCR.SUB.DEFINE%) & ! Put up the basic sublist screen. & 13020 CALL M11SCW ("name: "+NAM$, 2%, 27%) & ! Show user which sublist is being worked on. & 13030 BASE% = 7% & \ CALL M11SCW (HDR.CAT.PROMPT$(CAT%), BASE%+CAT%, 6%) & FOR CAT% = 1% TO 6% & ! Show the user the labels of the categories. & 13040 BASE% = 14% & \ FOR LINE% = FLINE% TO (FLINE% + 5%) & \ GO TO 13099 IF SEL.ACC.REJ$(LINE%) = "" & \ RLINE% = LINE% - FLINE% + 1% & \ CALL M11SCW (FN.DEPARSE$(LINE%), BASE% + RLINE%, 1%) & \ NEXT LINE% & ! Display the existing sublist definitions. & 13099 RETURN & 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 12750 IF ERL = 12730 AND ERR = 155 & \ RESUME 12730 IF ERL = 12730 AND ERR = 154 & \ RESUME 12730 IF ERL = 12750 AND ERR = 134 & ! Handle expected errors: & ! Tried to get this sublist. & ! Sublist record was locked. & ! Tried to PUT a record that already exists. & 19900 ERR.ERL% = ERL & \ ERR.ERR% = ERR & \ ERR.CODE% = FATAL.ERROR% & \ ERR.MSG$ = "Unexpected fatal error in M11SUP." & ! 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