     	FUNCTION DATCOD( DAY )
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY,  FEB-1987
C
C	THIS ROUTINE ENCODES D-500 SYSTEM DATE
C
     	CHARACTER DAY*9, DAT*6
     	CHARACTER*36 MONTHS
     	DATA MONTHS/'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'/

     	DATCOD = 0.0
     	IVAL = INDEX( MONTHS, DAY(4:6) )
     	IF( IVAL.GT.0 ) THEN
     	    DAT(1:2) = DAY(1:2)
     	    ENCODE( 2, 1, DAT(3:4) ) IVAL
     	    DAT(5:6) = DAY(8:9)
     	    DECODE( 6, 2, DAT, ERR=9 ) VAL
     	    DATCOD = VAL
     	ENDIF
1	FORMAT(I2)
2	FORMAT(F7.0)
9	RETURN
     	END
