C
C	SUBROUTINE  ENTERR
C
C	FUNCTION : TO CHECK THE RETURNED FUNCTION CODE AFTER THE IENTER
C		   HAS BEEN PERFORMED AND TO REPORT ALL POSSIBLE ERRORS .
C
C		  ON ERROR THE PROGRAM CAN GENERATE A DIVIDE BY ZERO TO 
C	   	  GIVE A TRACE BACK .
C
C
C
C	AUTHOR:	G. GUELFI	1-APRIL-1985
C
C
C	CALL IS
C
C	SUBROUTINE ENTERR(ICODE,IENT,NUM)
C
C		WHERE
C
C			ICODE	 IS IENTER FUNCTION VALUE
C			IENT	 CAN CONTAIN ERROR VALUE TO BE IGNORED
C				 AND IT RETURNS VALUE OF ICODE
C			NUM	 IS VALUE TO GENERATE TRACE BACK
C
C				IF NUM = 0 THEN TRACE BACK
C				IF NUM = 1 ONLY REPORT ERROR
C
C	SAMPLE -  CALL ENTERR(IENTER(CH,CHDAT,1),IENT,0)
C
	SUBROUTINE ENTERR(ICODE,IENT,NUM)
C
C
C	ERROR MESSAGES FOR IENTER
C
	IF (ICODE.GE.0.OR.ICODE.EQ.IENT) GOTO 100

D	DO 1 I = 1,14
D	J = I - 1
D	CALL CLOSEC(J)
D1	CALL IFREEC(J)
	TYPE *,ICODE,'  IENTER ERROR '
D	IF (ICODE.EQ.-1) TYPE *,'CHAN IN USE'
D	IF (ICODE.EQ.-2) TYPE *,'NOT ENOUGH SPACE '
D	IF (ICODE.EQ.-3) TYPE *,'DEVICE IN USE'
D	IF (ICODE.EQ.-4) TYPE *,'FILE EXISTS AND IS PROTECTED'
D	IF (ICODE.EQ.-5) TYPE *,'FILE SEQ NUM NOT FOUND'
	R = 1./NUM
100	IENT = ICODE
	RETURN
	END
