	FUNCTION DO(II)
C
C       This function provides the do-loop structure in the option list in
C  MIIPSOPT and is used for looping in usrinp.  The control string is 
C  executed until the list of values read by DO is exhausted.  These values 
C  are then made available to the selected option.  
C  E.g., DO($=1,2,3) OPT1(X=$) OPT2(Y=$).
C  	
	PARAMETER (NP=256)
	DIMENSION A(NP),B(NP)
C
	IF (II.EQ.0) THEN  ! FIRST ENTRY
	  CALL USRINP(A,NP,'F',4,0,'$=',
	1 'Enter the values for $ to be used in the do-loop:')
	  N=NEL(A,NP)   
	  DO I=1,N
	    B(I)=A(I)
	  END DO
	  CALL USRINP(B,N,'F',4,4,'&=',
	1 'Enter the values for & to be used in the do-loop:')
	  NBL=NEL(B,N)
	  IF (NBL.NE.N) CALL ERROR(-3,'UNEQUAL RANGE IN DO-LOOP VALUES')
	  I=1
	ELSE
	  I=I+1
	END IF
	IF (I.GT.N) THEN  ! TERMINATES LOOP
	  I=0
	  CALL MESSAGE('Do-loop has terminated')
	ELSE
	  WRITE(7,1000) A(I),B(I)
	  WRITE(6,1000) A(I),B(I)
 1000	  FORMAT(' DO-LOOP:  $=',G11.4,'   &=',G11.4)
	END IF
	II=I
	RETURN
C  RETURN CURRENT VALUE OF VARIABLE
	ENTRY DOVAL
	DOVAL=A(I)
	RETURN
	ENTRY DOVAL2
	DOVAL2=B(I)
	RETURN
	END
