C******************** START FILE UPQUER.FOR ; GROUP USPARM *************
C--------------------------------------------------------------
C&  UPQUER    QUERY USER AS TO VALUE OF UNIDENTIFIED PARAMETER
C
C   ZNAME-- 10 CHAR UNIDENTIFIED PARAMETER NAME (INPUT)
C   ZLINE-- 80 CHAR UNPACKED SPACE TO RECIEVE ANSWER (WHICH
C       MAY BE USED BY MAIN PROG (UREAD CALLER) FOR INPUT
C   LLINE-- LENGTH OF ZLINE (NORM. 80 CHARS.)
C   ZVAL--  OUTPUT PACKED 96 CHAR VALUE SPECIFIED
 
 
      SUBROUTINE UPQUER(ZNAME,ZLINE,LLINE,ZVAL)

      USE USERIO
C
      CHARACTER*16 ZNAME
      CHARACTER*96 ZVAL
      CHARACTER*1 ZLINE(LLINE),ZC1,ZC2
C
      logical il1lin
C
C-----------------------------------
C
      ILINE=LEN(ZVAL)+1
C
      IF(IBATCH.EQ.1) GO TO 80
C  IN INTERACTIVE MODE QUERY TOP LEVEL (USER) FOR PARAMETER VALUE
      ILNAM=ILNURD(ZNAME)
 70   WRITE(LUNTRM,7001) ZNAME(1:ILNAM)
 7001 FORMAT(
     >' % UPQUER: *** UNDEFINED UREAD STRING PARAMETER "',
     1  A,'" ENCOUNTERED.')
C
      CALL UPROMTX('   ENTER VALUE (MAX 96 CHARACTERS): ',0)
      CALL URDSTT('PARAMETER VALUE',ZVAL)
C
      ZLINE(ILINE)=' '
      DO I=1,ILINE-1
        ZLINE(I)=ZVAL(I:I)
      ENDDO
      IND1=1
      IND2=ILINE
      CALL USPLVL(ZLINE,ILINE,IND1,IND2,ZVAL,IER)
      IF(IER.NE.0) GO TO 70
      CALL UPSADL(ZNAME,ZVAL)
      NCLEAR=0
      CALL NEUPAG
      RETURN
C  BATCH MODE: QUERY TOP LEVEL (BATCH CONTROL FILE) FOR MISSING
C  PARAMETER VALUE; ACCEPT ANSWER IFF 1ST TWO CHARACTERS ARE "/="
C
 80   CONTINUE
      WRITE(LUNTRM,7001) ZNAME
      READ(LUNTIN(1),'(A1,A1,A)',ERR=85) ZC1,ZC2,ZVAL
      ZLINE(ILINE)=' '
      DO I=1,ILINE-1
        ZLINE(I)=ZVAL(I:I)
      ENDDO
      IF((ZC1.EQ.MSLASH).AND.(ZC2.EQ.MEQS)) GO TO 90
C  REJECT
 85   WRITE(LUNTRM,7002)
 7002 FORMAT(' ? UNANTICIPATED RESPONSE, PROGRAM EXECUTION'/
     >  '   HALTED, FORTRAN SUBROUTINE UPQUER ("USPARM.FOR")'///)
      CALL URDABO
C  OK
 90   CONTINUE
      IND1=1
      IND2=ILINE
      CALL USPLVL(ZLINE,ILINE,IND1,IND2,ZVAL,IER)
      IF(IER.NE.0) GO TO 85
      CALL UPSADL(ZNAME,ZVAL)
      RETURN
      	END
C******************** END FILE UPQUER.FOR ; GROUP USPARM ***************
