INTEGER FUNCTION INDEX( INSTR , PATTRN , ISTART ) C*********************************************************************** C C Description : Searches a string for the first occurrence of a pattern C returning the position of the first character of the match C C Arguments : INSTR = STRING wherein the search is taken place C PATTRN = BYTE array containg the pattern to be searched C ISTART = (optional) position in INSTR where search must start C Funval = 0 if PATTRN is not found C n position in INSTR of 1st matching char C C Author : T.Pijl C AKZO PHARMA, Oss Holland C dep. SDA C C Version : V1.0 Date : 14-dec-82 C C Module name : INDEX.FTN C C Package : RSX-LIBRARY C C Compilation/ C taskbuilding : FOR/F4P/TR:NONE INDEX C C Updates : name version C C description : C C************************************************************************ BYTE INSTR(1),PATTRN(1) IL1=LEN(INSTR) IL2=LEN(PATTRN) IS=1 IF( LARG(3) ) IS=ISTART DO 20 I=IS,IL1-IL2+1 DO 10 J=1,IL2 IF( INSTR(I+J-1) .NE. PATTRN(J) ) GOTO 20 10 CONTINUE INDEX=I IF( INDEX .GT. IL1 ) GOTO 30 GOTO 90 20 CONTINUE 30 INDEX=0 90 RETURN END