	FUNCTION NAMCMP(IR501,IR502,N)
C FUNCTION TO COMPARE TWO ASCII STRINGS, INCLUDING WILD CARDS.
C MAXIMUM: 12 'CHARACTERS' (4 RAD50 INTEGERS).
C FILED--5-APR-83, G. BEVER.
C
C WHERE:
C
C	IR501 = BASE OR COMPARISON STRING (MAY CONTAIN WILDCARDS).
C	IR502 = NEW OR CURRENT STRING (NO WILDCARDS).
C	N=      LENGTH IN CHARACTERS OF NSTRNG.
C
	BYTE BSTRNG(12),NSTRNG(12)
	INTEGER*2 IR501(4),IR502(4)
C
	CALL R50ASC(N,IR501,BSTRNG)	! CONVERT RAD50 TO ASCII.
	CALL R50ASC(N,IR502,NSTRNG)	! CONVERT RAD50 TO ASCII.
C
	IWILD=0
	J=1	! COMPARE
	K=1	! TEST
2	IF(K.LE.N) GO TO 5	! IF OUT OF RANGE, GO TO 999.
	IF(IWILD.EQ.1) GO TO 998! IF WILDCARD COMPARE ENABLED, 998.
	IF(J.LT.N.AND.BSTRNG(J+1).NE.' ') GO TO 998 ! IF MORE IN COMPARE
C				! STRING, BUT TEST STRING FINISHED, GO TO 998.
	GO TO 999		! GOOD COMPARE.
5	IF('/'.NE.BSTRNG(J)) GO TO 10	! IF COMPARE CHAR NOT '*', GOTO 10.
	IWILD=1			! SET PREVIOUS CHAR TO '*'.
	J=J+1			! GET NEXT TEST BYTE.
	GO TO 2
10	IF('.'.NE.BSTRNG(J)) GO TO 20	! IF COMPARE CHAR NOT '%', GOTO 20.
	IF(NSTRNG(K).EQ.' ') GO TO 998	! IF TEST CHAR = ' ', GO TO 998.
	J=J+1			! GET NEXT TEST BYTE.
	K=K+1			! GET NEXT COMPARE BYTE.
	IF(IWILD.EQ.1) GO TO 2	! IF PREVIOUS CHAR WAS '*', GO TO 2.
	GO TO 3
20	IF(' '.EQ.BSTRNG(J)) GO TO 40 ! IF COMPARE CHAR IS ' ', GO TO 40.
	IF(IWILD.EQ.1) GO TO 25	! IF WILDCARD COMPARE ENABLED, GO TO 25.
	IF(BSTRNG(J).NE.NSTRNG(K)) GOTO 998! IF TEST & COMP BYTE COMPARE, 998
	J=J+1			! GET NEXT TEST BYTE.
	K=K+1			! GET NEXT COMPARE BYTE.
	GO TO 3
25	IF(BSTRNG(J).NE.NSTRNG(K)) GO TO 30 ! IF BYTES DON'T COMPARE, GOTO 30.
	J=J+1			! GET NEXT TEST BYTE.
	K=K+1			! GET NEXT COMPARE BYTE.
	GO TO 3
30	K=K+1			! GET NEXT COMPARE BYTE.
	GO TO 2
40	IF(IWILD.EQ.1) GO TO 999! IF WILDCARD COMPARE ENABLED, GO TO 999.
	IF(NSTRNG(K).EQ.' ') GO TO 999! IF TEST BYTE IS ' ', GO TO 999.
	GO TO 998
3	IWILD=0			! CLEAR WILDCARD COMPARE FLAG.
	GO TO 2
C
998	NAMCMP=0		! NO COMPARE.
	RETURN
999	NAMCMP=1		! COMPARE.
	RETURN
	END
