C+ C Match_Strings C C The function of this subroutine is to take a match string and see C if it is contained within the record. C C CALL Match_Strings(Cmatch, Crecord, Imatch) C C Where Cmatch Character*(*) String to search for C Crecord Character*(*) Record to check C Imatch I*4 Match status C = 0 No match C = 1 A match C C Now, more than one search string may conceivably be contained in C Cmatch. We will adopt the convention that a | will delimit the C substrings within Cmatch since the "|" is rarely used. If the C first part of the string is matched, the latter half will be checked C Success is only returned if all fields match. C C Written by: C James G. Downward C KMS Fusion, Inc. C PO. Box 1567 C Ann Arbor, Mich. 48106 C 18-Jan-1982 C Modified: C James G. Downward Bug fixes to allow matching C 23-Mar-1983 more than 2 substrings C- SUBROUTINE Match_Strings(Cmatch, Crecord, Imatch) C IDENT /2/ CHARACTER*(*) Cmatch ! substrings to match CHARACTER*(*) Crecord ! Record to check Ilen=LEN(Cmatch) ! Istart=1 ! Imatch=0 ! Assume no match 10 Ipos=INDEX(Cmatch(Istart:Ilen),'|') ! Multiple strings IF(Ipos.EQ.0) THEN ! If EQ 0, no Ipos2=INDEX(Crecord,Cmatch(Istart:Ilen)) ! check single match IF(Ipos2.GT.0) Imatch=1 ! Show success RETURN ! ELSE ! Ah multiple strings Ipos=Ipos+Istart-1 Ipos2=INDEX(Crecord,Cmatch(Istart:Ipos-1)) ! Check first part IF(Ipos2.EQ.0) RETURN ! alas, no match Istart=Ipos+1 ! got 1st, try again IF(Istart.GT.Ilen) RETURN ! | at eol?? GOTO 10 ! END IF ! END !