	FUNCTION IPUT(IVAR,IDIGIT,IVAL,IADIF1)
C	ROUTINE TO ALTER DIGITS IN INTEGER VARIABLES
C	IF IADIF1=0, IVAL IS STORED IN DIGIT IDIGIT OF VARIABLE IVAR.
C	IF IADIF1=1, IVAL IS ADDED TO IDIGIT OF IVAR.
C	IF IADIF1=-1, IVAL IS SUBTRACTED FROM IDIGIT OF IVAR.
C	NOTE THAT IF ADDING OR SUBTRACTING FROM DIGIT IN IVAR, ONLY
C	THE MAGNITUDE IS CONSIDERED - SIGN OF IVAR IS IGNORED BUT
C	UNCHANGED.
C	OTHER VALUES OF IADIF1 CAUSE ERROR
C 
C	IF ABS. VALUE OF IVAR WILL EXCEED 29999, ERROR RESULTS.
C 
C	'ERROR' MEANS IVAR WILL BE RETURNED UNCHANGED, VALUE OF
C	FUNCTION IPUT WILL BE 1
C	IF CALL IS SUCCESSFUL, IPUT=0
C	IDIGIT = 1 TO 5 FROM LEFT TO RIGHT IN IVAR (23145->IDIGIT 1=2
	IF(IDIGIT.LT.1.OR.IDIGIT.GT.5) RETURN
	ITEMP=IABS(IVAR)
	JSIGN=1
	IF(IVAR.NE.0) JSIGN=IVAR/ITEMP
	I=6-IDIGIT
	IPUT=1
	IADD=0
	ISIGN=1
	IF(IADIF1.EQ.0) GOTO 1
	IF(IADIF1.LT.-1.OR.IADIF1.GT.1) RETURN  ! INVALID
	ISIGN=IADIF1
	IADD=1
1	IOLD=IGET(ITEMP,IDIGIT)
	NEWVAL=IOLD*IADD+IVAL*ISIGN
	IF(NEWVAL.GT.9.OR.NEWVAL.LT.0) RETURN
	IF(NEWVAL.GT.2.AND.IDIGIT.EQ.1) RETURN
	NEWVAL=NEWVAL-IOLD
	IVAR=ITEMP+NEWVAL*10**(I-1)
	IVAR=IVAR*JSIGN
	IPUT=0
	RETURN
	END
