13500 !-------------------------------------------------------------------- & ! & ! Check if an address is in a sublist & ! & !-------------------------------------------------------------------- & ! & ! input: ADD.- address fields & ! SEL.- sublist selection criteria & ! M11.LIST.CODE$ = A,S,T sublist code & ! M11.LAST.LINE% number of sublist definition & ! lines & ! HDR.CAT.TYPE$(10%) array which indicates type & ! (A, D, or N) of each category & ! HDR.SYS.DEF.PRIME.ID$ Is the Primary ID system & ! defined? & ! HDR.FIELD.LEN%(20%) array which contains the & ! length of all address fields & ! & ! output: MATCH% = TRUE% if address is in sublist & ! FALSE% if address is NOT in sublist & ! & ! local: & ! & ! ARRAY.SIZE% Number of entries in TRUTH.ARRAY% & ! FIELD$ Variable which contains the edited value & ! from the address record & ! FIELD.NUM% Integer between 1-10 to indicate which field & ! is specified in the current sublist def line & ! FIELD.TYPE$ A = Alphanumeric, D = Date, N = Numeric,Y=Y/N & ! LAST.FIELD.NUM% Previous value of FIELD.NUM% & ! LINE% Line number of sublist def line currently & ! being processed & ! LOG.CONNECTOR% Logical connector (AND or OR) between the & ! current sublist def line and the previous one & ! OP.CODE% 1 = equals, 2 = greater than, 3 = less than & ! 4 = between & ! THIS.LINE% Is the current def line TRUE or FALSE & ! TSUB% Truth subscript & ! VAL1$ Edited value from sublist definition (to be & ! compared with FIELD$) & ! VAL2$ Edited 2nd value (used in BETWEEN condition & ! test) & ! L.VAL1% Length of the string VAL1$ & ! & ! NOTE: The following arrays are used locally by this & ! subroutine but must be dimensioned separately in & ! the calling module: & ! & ! TRUTH%(30%) One logical entry for each sublist def line & ! AND.OR%(30%) AND or OR with the previous def line & ! & ! NOTE: The following constants must be initialized by the & ! calling module (or by M11INT): & ! & ! AND% Constant value for logical AND & ! OR% Constant value for logical OR & ! TRUE% Constant value for logical TRUE & ! FALSE% Constant value for logical FALSE & ! & ! NOTE: This subroutine also uses the following functions & ! which must be appended into the calling module: & ! & ! FN.DATE.CNV$ converts a date from DD-MMM-YY to YYMMDD & ! FN.RJZF$ converts a left justified string to a right & ! justified, zero filled numeric string & ! & ! Assumptions: & ! & ! - Sublist definition is already in memory (MAPSEL) & ! & !-------------------------------------------------------------------- & 13520 MATCH% = TRUE% & \ RETURN IF M11.LIST.CODE$ = "A" & \ TSUB% = 0% & \ LAST.FIELD.NUM% = 0% & \ FOR LINE% = 1% TO M11.LAST.LINE% & \ GO SUB 13550 ! Evaluate the current line & \ NEXT LINE% ! and add result to the truth & ! array & ! If "All" was selected then the address automatically matches. & ! Otherwise, initialize flags and subscripts. Then evaluate each & ! line of the sublist definition until all lines have been evaluated. & ! Put the results of each lines evaluation in the truth array, and & ! when all lines are done, evaluate the truth array. & 13530 !-------------------------------------------------------------------- & ! & ! Evaluate the Truth Array & ! & !-------------------------------------------------------------------- & & ARRAY.SIZE% = TSUB% & \ MATCH% = TRUTH%(1%) & \ FOR TSUB% = 2% TO ARRAY.SIZE% & \ IF AND.OR%(TSUB%) = AND% & THEN MATCH% = (MATCH% AND TRUTH%(TSUB%)) & ELSE MATCH% = (MATCH% OR TRUTH%(TSUB%)) & ! For each element in the truth array, logically combine the previous & ! result with the current element. & 13534 NEXT TSUB% ! MATCH% now contains the final result. Go back. ! print val1$ ! print field$ ! print val2$ if op.code% = 4% ! print 'match% =';match% ! print 13540 RETURN & & 13550 !-------------------------------------------------------------------- & ! & ! Check address against current sublist line & ! & !-------------------------------------------------------------------- & 13560 FIELD$ = "" & \ FIELD.NUM% = VAL (SEL.FIELD.NUM$(LINE%)) & \ FIELD.TYPE$ = "A" & \ IF FIELD.NUM% = 1% & THEN IF HDR.SYS.DEF.PRIME.ID$ = "Y" OR HDR.SYS.DEF.PRIME.ID$="1" & THEN FIELD$ = EDIT$ (ADD.PRIME.ID$, 8%) & \ FIELD$ = & STRING$((HDR.FIELD.LEN%(1%)-LEN(FIELD$)),48%) & + FIELD$ & \ FIELD.TYPE$ = "N" & ELSE FIELD$ = ADD.PRIME.ID$ & ELSE IF FIELD.NUM% = 2% & THEN FIELD$ = ADD.ALTERNATE.ID$ & ELSE IF FIELD.NUM% = 3% & THEN FIELD$ = FN.RJZF$(NUM1$(ADD.COUNTER%), & HDR.FIELD.LEN%(3%)) & \ FIELD.TYPE$ = "N" & ELSE IF FIELD.NUM% = 4% & THEN FIELD$ = ADD.ZIP$ & ELSE IF FIELD.NUM% = 16% & THEN FIELD$ = ADD.STATE$ & ELSE IF FIELD.NUM% > 10% & THEN FIELD$ = ADD.ADDR$(FIELD.NUM%-11%) & ELSE FIELD.TYPE$ = HDR.CAT.TYPE$(FIELD.NUM%-4%) & \ FIELD$ = ADD.CATEGORIES$(FIELD.NUM% - 5%) & ! Initialize FIELD$ variable and increment line number. Check to & ! see if we've finished processing sublist definition lines. If so & ! exit. Otherwise, get the field number and get the actual field & ! contents out of the address MAP. Determine field type (A,D,N,Y,C). & ! & !-------------------------------------------------------------------- & ! & ! NOTE: A - Primary ID (user generated) & ! Alternate ID & ! Name/address lines/city/state & ! ZIP code & ! Categories & ! & ! N - Primary ID (system generated) & ! Counter & ! Categories & ! & ! D - Categories & ! & ! Y - Categories & ! & !-------------------------------------------------------------------- & & 13565 IF FIELD.NUM% > 4% AND FIELD.NUM% < 11% THEN & & IF FIELD.TYPE$ = "N" THEN LENG% = HDR.FIELD.LEN%(FIELD.NUM% +6%) & \ FIELD$ = FN.RJZF$ (FIELD$, LENG%) & ELSE IF FIELD.TYPE$ = "D" THEN FIELD$ = FN.DATE.CNV$ (FIELD$) & ELSE FIELD$ = EDIT$ (FIELD$,32%) & ! If it's a category and it's numeric or a date, then perform the & ! converison. & 13570 GOTO 13575 UNLESS FIELD.TYPE$ = "C" ! This line checks the coded category type. OP.CODE% = VAL (SEL.OP.CODE$(LINE%)) VAL1$ = EDIT$( SEL.VALUE.1$(LINE%), 160%) VAL2$ = EDIT$( SEL.VALUE.2$(LINE%), 160%) IF OP.CODE% = 4% ! Initialize comparison type ( 1 = equals, 2 = above, ! 3 = below, 4 = between ) and comparison fields. The ! second comparison field is only used for 'between' tests. ! Remove trialing spaces and upcase. THIS.LINE% = FALSE% ! Initialize truth value of this line FOR CHAR% = 1% TO LEN ( VAL1$ ) C1$ = SEG$ ( VAL1$, CHAR%, CHAR% ) ITERATE IF C1$ = PRM.WILDCARD.CHR$ F$ = SEG$ ( FIELD$, CHAR%, CHAR% ) C2$ = SEG$ ( VAL2$, CHAR%, CHAR% ) IF OP.CODE% = 4% ! Extract a character from first comparison string. ! Iterate the loop if comparison character is a wild card. ! Extract a character from record field, and from the second ! comparison string if this is a 'between' test. SELECT OP.CODE% CASE 1% !print ' case 1 (equal)' !print ' character position = ';char% !print ' field character is ';f$ !print ' comparison character is';c1$ GOTO 13580 IF F$ <> C1$ CASE 2% !print ' case 2 (above)' !print ' character position = ';char% !print ' field character is ';f$ !print ' comparison character is';c1$ GOTO 13580 IF F$ <= C1$ CASE 3% !print ' case 3 (below)' !print ' character position = ';char% !print ' field character is ';f$ !print ' comparison character is';c1$ GOTO 13580 IF F$ >= C1$ CASE 4% !print ' case 4 (between)' !print ' character position = ';char% !print ' lower character is ';c1$ !print ' field character is ';f$ !print ' higher character is';c2$ GOTO 13580 UNLESS ( (F$ >= C1$) AND (F$ <= C2$) ) END SELECT NEXT CHAR% THIS.LINE% = TRUE% GOTO 13580 ! If here this line is true. 13575 OP.CODE% = VAL (SEL.OP.CODE$(LINE%)) & \ VAL1$ = SEL.VALUE.1$(LINE%) & \ VAL2$ = SEL.VALUE.2$(LINE%) IF OP.CODE% = 4% & \ THIS.LINE% = FALSE% & \ FIELD$ = EDIT$ (FIELD$, 32%) & \ IF OP.CODE% = 1% & THEN THIS.LINE% = TRUE% IF FIELD$ = VAL1$ & ELSE IF OP.CODE% = 2% & THEN THIS.LINE% = TRUE% IF FIELD$ > VAL1$ & ELSE IF OP.CODE% = 3% & THEN THIS.LINE% = TRUE% IF FIELD$ < VAL1$ & ELSE IF OP.CODE% = 4% & THEN THIS.LINE% = TRUE% & IF FIELD$ >= VAL1$ AND FIELD$ <= VAL2$ & ! Make the comparison based on op code. & 13580 THIS.LINE% = NOT THIS.LINE% & IF SEL.ACC.REJ$(LINE%) = "R" ! If this is a test for negativity, then NOT the result. !IF THIS.LINE% = TRUE% !THEN ! PRINT 'This line is true.' ! ELSE ! PRINT 'This line if false.' ! END IF 13600 !-------------------------------------------------------------------- & ! & ! & ! & ! Add the Result of the Evaluation of the Current Line & ! to the Truth Array & ! & ! & ! & !-------------------------------------------------------------------- & 13620 LOG.CONNECTOR% = AND% & \ LOG.CONNECTOR% = OR% IF SEL.PR.CODE$(LINE%) = "1" & \ IF FIELD.NUM% = LAST.FIELD.NUM% & THEN IF LOG.CONNECTOR% = AND% & THEN TRUTH%(TSUB%) = (TRUTH%(TSUB%) AND THIS.LINE%) & ELSE TRUTH%(TSUB%) = (TRUTH%(TSUB%) OR THIS.LINE%) & ELSE TSUB% = TSUB% + 1% & \ TRUTH%(TSUB%) = THIS.LINE% & \ AND.OR%(TSUB%) = LOG.CONNECTOR% & ! Determine whether the sublist definition specifies AND or OR as a & ! logical connector. If the field number for the current sublist & ! def line is equal to the field number for the last line, then & ! logically combine the two truth value and put the result in the & ! same array element as the LAST result was stored in. However, if & ! the field number for the current definition is different, put the & ! the current result in the NEXT array element. Also, store the & ! logical connector for the current definition in the AND.OR% array. & 13640 LAST.FIELD.NUM% = FIELD.NUM% & \ RETURN & ! Save the current field number. &