      SUBROUTINE QEDATA
     I                  (MESSFL)
C
C     + + + PURPOSE + + +
C     edit user selected data cards
C
C     + + + DUMMY ARGUMENTS + + +
      INTEGER   MESSFL
C
C     + + + ARGUMENT DEFINITIONS + + +
C     MESSFL - Fortran unit number for message file
C
C     + + + COMMON BLOCKS + + +
      INCLUDE 'CQ2VAL.INC'
C
C     + + + LOCAL VARIABLES + + +
      INTEGER      I,J,I1,SCLU,SGRP,LCLU,RESP,LEN,RNUM,CNUM,JUST,
     1             IRET,IVAL(1,200),CVAL(1,3,200)
C     1             IRET,IVAL(1,50),CVAL(1,3,50)
      REAL         RVAL(7,200)
C      REAL         RVAL(7,50)
      CHARACTER*1  BLNK,TBUFF(80,200)
C      CHARACTER*1  BLNK,TBUFF(80,50)
      CHARACTER*22 SCNAME
C
C     + + + EXTERNALS + + +
      EXTERNAL     QRESP, MTIT, MPCD, QEGANP, QETHET, QRESCN, QRESCX
      EXTERNAL     QSUCEL, ZIPC, CHRCHR, DECCHR, QEFLAU, ZWNSET, QEPRPL
      EXTERNAL     QEINCO, QEINFL, QEHEAD, QEPTLD, QEDSBD, QRESPM
C
C     + + + END SPECIFICATIONS + + +
C
      I1  = 1
      SCLU= 15
      JUST= 0
      BLNK= ' '
C
 5    CONTINUE
C       select data options until Return
        SGRP= 1
        CALL QRESP (MESSFL,SCLU,SGRP,RESP)
C       check user exit command value
        CALL ZGTRET (IRET)
        IF (IRET.EQ.1) THEN
C         user wants to continue
          GO TO (10,20,30,40,50,60,70,80,90,100,110,120,130,
     1           140,150,160,170,180,190,200,210,220), RESP
C
 10       CONTINUE
C           title data
            CALL MTIT (MESSFL,SCLU,
     M                 QTITLE,BNAME,
     M                 CNAME,CUNITS,CSOPT,BODOPT)
            GO TO 999
C
 20       CONTINUE
C           program control data
            CALL MPCD (MESSFL,SCLU,METFLG,
     M                 NPOPT,PCIVL,PCRVL,MAXITR)
            GO TO 999
C
 30       CONTINUE
C           global A, N, and P parameters
            SCNAME= 'Data 1A (ED1A)'
            CALL QEGANP (MESSFL,METFLG,SCNAME,
     M                   GPARM)
            GO TO 999
C
 40       CONTINUE
C           theta values
            SCNAME= 'Data 1B (ED1B)'
            CALL QETHET (MESSFL,SCNAME,
     M                   THEIND,THEVAL)
            GO TO 999
C
 50       CONTINUE
C           view reach identification data, can't change
            I= 80* NUMRCH
            CALL ZIPC (I,BLNK,TBUFF)
            DO 55 I= 1, NUMRCH
              LEN= 16
              CALL CHRCHR(LEN,RCHNAM(1,I),TBUFF(6,I))
              LEN= 5
              CALL DECCHR (DAT2(1,I),LEN,JUST,J,TBUFF(1,I))
              LEN= 10
              CALL DECCHR (DAT2(2,I),LEN,JUST,J,TBUFF(22,I))
              CALL DECCHR (DAT2(3,I),LEN,JUST,J,TBUFF(32,I))
55          CONTINUE
            LEN= 41
            RNUM= 3
            SGRP= 5+ METFLG
            CALL QRESCX (MESSFL,SCLU,SGRP,I1,RNUM,I1,NUMRCH,I1,
     M                   IVAL,DAT2,CVAL,TBUFF)
            GO TO 999
C
 60       CONTINUE
C           flow augmentation data
            SCNAME= 'Data 3 (ED3)'
            DO 65 I= 1,NUMRCH
              DAT3R(1,I)= DAT2(1,I)
 65         CONTINUE
            CALL QEFLAU (MESSFL,NUMRCH,SCNAME,
     M                   DAT3I,DAT3R)
            NPOPT(3)= 2
            DO 68 I= 1,NUMRCH
              IF (DAT3I(I).GT.0) NPOPT(3)= 1
 68         CONTINUE
            GO TO 999
C
 70       CONTINUE
C           computational element flags
            SCNAME= 'Data 4 (ED4)'
            CALL QSUCEL (MESSFL,NUMRCH,NCMPEL,
     I                   NUMHDW,NUMJUN,NUMPTL,SCNAME,
     M                   CMPELF,I)
            GO TO 999
C
 80       CONTINUE
C           hydraulic data
            SCNAME= 'Data 5 (ED5)'
            DO 85 I= 1,NUMRCH
              DAT5(1,I)= DAT2(1,I)
 85         CONTINUE
            CALL ZWNSET (SCNAME)
            LCLU= 11
            RNUM= 7
            SGRP= 2+ NPOPT(5)+ (2* METFLG)
            CALL QRESCN (MESSFL,LCLU,SGRP,I1,RNUM,I1,NUMRCH,I1,
     M                   IVAL,DAT5,CVAL,TBUFF)
            GO TO 999
C
 90       CONTINUE
C           temp and local clim data, group data5a, form 8a
            SCNAME= 'Data 5A (ED5A)'
            DO 95 I= 1,NUMRCH
              DAT5A(1,I)= DAT2(1,I)
 95         CONTINUE
            CALL ZWNSET (SCNAME)
            LCLU= 13
            RNUM= 8
            SGRP= 4+ METFLG
            CALL QRESCN (MESSFL,LCLU,SGRP,I1,RNUM,I1,NUMRCH,I1,
     M                   IVAL,DAT5A,CVAL,TBUFF)
C           indicate Local Clim will not be used
            CLDAT(1,1)= -999.
            GO TO 999
C
 100      CONTINUE
C           BOD/DO coefficents
            SCNAME= 'Data 6 (ED6)'
            CALL ZWNSET (SCNAME)
            DO 104 I= 1,NUMRCH
              DAT6(1,I)  = DAT2(1,I)
              DO 102 J= 1,4
                RVAL(J,I)= DAT6(J,I)
 102          CONTINUE
              CVAL(1,1,I)= DAT6(5,I)
              RVAL(5,I)  = DAT6(6,I)
              RVAL(6,I)  = DAT6(7,I)
              RVAL(7,I)  = DAT6(8,I)
 104        CONTINUE
            LCLU= 12
            RNUM= 7
            CNUM= 1
            SGRP= 2+ METFLG
            CALL QRESCN (MESSFL,LCLU,SGRP,I1,RNUM,CNUM,NUMRCH,I1,
     M                   IVAL,RVAL,CVAL,TBUFF)
            DO 108 I= 1,NUMRCH
              DO 106 J= 1,4
                DAT6(J,I)= RVAL(J,I)
 106          CONTINUE
              DAT6(5,I)= CVAL(1,1,I)
              DAT6(6,I)= RVAL(5,I)
              DAT6(7,I)= RVAL(6,I)
              DAT6(8,I)= RVAL(7,I)
 108        CONTINUE
            GO TO 999
C
 110      CONTINUE
C           N and P coefficients
            SCNAME= 'Data 6A (ED6A)'
            CALL ZWNSET (SCNAME)
            DO 115 I= 1,NUMRCH
              DAT6A(1,I)= DAT2(1,I)
 115          CONTINUE
            LCLU= 12
            RNUM= 9
            SGRP= 4+ METFLG
            CALL QRESCN (MESSFL,LCLU,SGRP,I1,RNUM,I1,NUMRCH,I1,
     M                   IVAL,DAT6A,CVAL,TBUFF)
            GO TO 999
C
 120      CONTINUE
C           algae/other coefficients
            SCNAME= 'Data 6B (ED6B)'
            CALL ZWNSET (SCNAME)
            DO 125 I= 1,NUMRCH
              DAT6B(1,I)= DAT2(1,I)
 125          CONTINUE
            LCLU= 12
            RNUM= 8
            SGRP= 6+ METFLG
            CALL QRESCN (MESSFL,LCLU,SGRP,I1,RNUM,I1,NUMRCH,I1,
     M                   IVAL,DAT6B,CVAL,TBUFF)
            GO TO 999
C
 130      CONTINUE
C           initial conditions
            SCNAME= 'Data 7-1 (ED7)'
            DO 135 I= 1,NUMRCH
              DAT7(1,I) = DAT2(1,I)
              DAT7A(1,I)= DAT2(1,I)
 135        CONTINUE
            CALL QEINCO (MESSFL,NUMRCH,METFLG,SCNAME,
     M                   DAT7,DAT7A)
            GO TO 999
C
 140      CONTINUE
C           incremental load
            SCNAME= 'Data 8-1 (ED8)'
            DO 145 I= 1,NUMRCH
              DAT8(1,I) = DAT2(1,I)
              DAT8A(1,I)= DAT2(1,I)
 145        CONTINUE
            CALL QEINFL (MESSFL,NUMRCH,METFLG,SCNAME,
     M                   DAT8,DAT8A)
            GO TO 999
C
 150      CONTINUE
C           view stream junction data, can't change
            IF (NUMJUN.GT.0) THEN
              I= 80* NUMJUN
              CALL ZIPC (I,BLNK,TBUFF)
              SGRP= 7
              RNUM= 4
              DO 162 I= 1,NUMJUN
                LEN  = 16
                CALL CHRCHR(LEN,JUNNAM(1,I),TBUFF(6,I))
                LEN  = 5
                CALL DECCHR (DAT9(1,I),LEN,JUST,J,TBUFF(1,I))
                LEN  = 9
                CALL DECCHR (DAT9(2,I),LEN,JUST,J,TBUFF(22,I))
                CALL DECCHR (DAT9(3,I),LEN,JUST,J,TBUFF(31,I))
                CALL DECCHR (DAT9(4,I),LEN,JUST,J,TBUFF(40,I))
162           CONTINUE
              CALL QRESCX (MESSFL,SCLU,SGRP,I1,RNUM,I1,NUMJUN,I1,
     M                     IVAL,DAT9,CVAL,TBUFF)
            END IF
            GO TO 999
C
 160      CONTINUE
C           headwater data
            SCNAME= 'Data 10-1 (ED10)'
            CALL QEHEAD (MESSFL,NUMHDW,METFLG,SCNAME,
     M                   HDWNAM,DAT10,DAT10A)
            GO TO 999
C
 170      CONTINUE
C           point-load and withdrawal
            SCNAME= 'Data 11-1 (ED11)'
            CALL QEPTLD (MESSFL,NUMPTL,METFLG,SCNAME,
     M                   PTLNAM,DAT11,DAT11A)
            GO TO 999
C
 180      CONTINUE
C           dam reaeration coefficients
            SCNAME= 'Data 12 (ED12)'
            CALL ZWNSET (SCNAME)
            LCLU= 10
            SGRP= 11+ METFLG
            RNUM= 7
            CALL QRESCN (MESSFL,LCLU,SGRP,I1,RNUM,I1,MXDAM,I1,
     M                   IVAL,DAT12,CVAL,TBUFF)
            GO TO 999
C
 190      CONTINUE
C           downstream boundary
            SCNAME= 'Data 13-1 (ED13)'
            IF (PCIVL(1).NE.1) THEN
C             downstream boundary option not on, does user want it on?
              CALL ZWNSET (SCNAME)
              SGRP= 8
              CALL QRESP (MESSFL,SCLU,SGRP,I)
              IF (I.EQ.1) PCIVL(1)= 1
            ELSE
C             downstream boundary option is on, allow modifications
              I= 1
            END IF
            IF (I.EQ.1) THEN
C             modify downstream boundary condition data
              CALL QEDSBD (MESSFL,METFLG,SCNAME,
     M                     DAT13,DAT13A)
            END IF
            GO TO 999
C
 200      CONTINUE
C           local climatology data
            SCNAME= 'Local (EDL)'
            CALL ZWNSET (SCNAME)
            LCLU= 13
            SGRP= 8+ METFLG
            RNUM= 5
            CALL QRESPM (MESSFL,LCLU,SGRP,I1,RNUM,I1,
     M                   IVAL,CLDAT(2,1),CVAL,TBUFF)
C           indicate Local Clim will be used
            CLDAT(1,1)= 1.0
            GO TO 999
C
 210      CONTINUE
C           DO and BOD reach plot data
            SCNAME= 'Plot - number of (EDP)'
            CALL QEPRPL (MESSFL,NUMRCH,SCNAME,MXPLT,MXRCH,
     M                   NUMPLT,PLTSTR,PLTRCH)
            GO TO 999
C
 220      CONTINUE
C           return to Edit
            GO TO 999
C
 999      CONTINUE
        END IF
C
      IF (RESP.NE.22 .AND. IRET.EQ.1) GO TO 5
C
      RETURN
      END
