      SUBROUTINE QEFGEN
     I                  (MESSFL)
C
C     + + + PURPOSE + + +
C     edit general functional parameters
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,K,I0,I1,SCLU,SGRP,RESP,INUM,RNUM,CNUM,
     1             IVAL(1,MXRCH),CVAL(22,3,MXRCH),TLEN,IRET,TMPOPT
      REAL         RVAL(1,MXRCH)
      DOUBLE PRECISION DVAL(1,1)
      CHARACTER*1  LBUFF(108),TBUFF(80,MXRCH),BLNK
      CHARACTER*23 SCNAME
C
C     + + + EXTERNALS + + +
      EXTERNAL     QRESP, QRESCZ, QRESPX, CHRCHR, ZIPC, QRESCN
      EXTERNAL     QEINCO, QEFLAU, QRESPM, ZGTRET
      EXTERNAL     QEPRPL, QEGANP
C
C     + + + END SPECIFICATIONS + + +
C
      I0  = 0
      I1  = 1
      BLNK= ' '
      SCLU= 9
C
 5    CONTINUE
C
        SGRP= 1
        CALL QRESP (MESSFL,SCLU,SGRP,RESP)
C
        GO TO (10,20,30,40,50,60,70,80), RESP
C
 10     CONTINUE
C         title data
          TLEN= 59
          CALL CHRCHR (TLEN,QTITLE,LBUFF)
          CALL CHRCHR (TLEN,BNAME,LBUFF(60))
          TLEN= 118
          CNUM= 2
          SGRP= 2
          CALL QRESCZ (MESSFL,SCLU,SGRP,I1,I1,I1,CNUM,I1,I1,TLEN,
     M                 IVAL,RVAL,DVAL,CVAL,LBUFF)
C
C         get titles from buffer
          TLEN= 59
          CALL CHRCHR (TLEN,LBUFF,QTITLE)
          CALL CHRCHR (TLEN,LBUFF(60),BNAME)
          GO TO 100
C
 20     CONTINUE
C         constituent to be modeled options
          TLEN= 80
          CALL ZIPC(TLEN,BLNK,TBUFF)
C         put constituent to be modeled options in buffer
          TLEN= 4
          DO 22 I= 1,4
C           conservative minerals (name,units) and arbitrary non-conservative
            J= 3*(I-1)*TLEN+ 1
            IF (I.EQ.4) THEN
              CALL CHRCHR (TLEN-1,CSOPT(1,11),TBUFF(J,1))
            ELSE
              CALL CHRCHR(TLEN-1,CSOPT(1,I),TBUFF(J,1))
            END IF
            J= J+ TLEN
            CALL CHRCHR(TLEN,CNAME(1,I),TBUFF(J,1))
            J= J+ TLEN
            CALL CHRCHR(TLEN,CUNITS(1,I),TBUFF(J,1))
 22       CONTINUE
          K= J
          DO 24 I= 4,10
C           other constituents
            J= K+ (I-3)*TLEN
C           screen positions for Algae and DO opposite of input file
            IF (I.EQ.6) THEN
              CALL CHRCHR (TLEN-1,CSOPT(1,9),TBUFF(J,1))
            ELSE IF (I.EQ.9) THEN
              CALL CHRCHR (TLEN-1,CSOPT(1,6),TBUFF(J,1))
            ELSE
              CALL CHRCHR (TLEN-1,CSOPT(1,I),TBUFF(J,1))
            END IF
 24       CONTINUE 
C         5-day or ultimate BOD
          CVAL(20,1,1)= BODOPT
          CNUM= 20
          SGRP= 3
          CALL QRESPX (MESSFL,SCLU,SGRP,I1,I1,CNUM,
     M                 IVAL,RVAL,CVAL,TBUFF)
C
          TLEN= 4
          DO 26 I= 1,4
            J= 3*(I-1)*TLEN+ 1
            IF (I.EQ.4) THEN
              CALL CHRCHR (TLEN-1,TBUFF(J,1),CSOPT(1,11))
            ELSE
              CALL CHRCHR(TLEN-1,TBUFF(J,1),CSOPT(1,I))
            END IF
            J= J+ TLEN
            CALL CHRCHR(TLEN,TBUFF(J,1),CNAME(1,I))
            J= J+ TLEN
            CALL CHRCHR(TLEN,TBUFF(J,1),CUNITS(1,I))
 26       CONTINUE
          K= J
          DO 28 I= 4,10
            J= K+ (I-3)*TLEN
C           screen positions for Algae and DO opposite of input file
            IF (I.EQ.6) THEN
              CALL CHRCHR (TLEN-1,TBUFF(J,1),CSOPT(1,9))
            ELSE IF (I.EQ.9) THEN
              CALL CHRCHR (TLEN-1,TBUFF(J,1),CSOPT(1,6))
            ELSE
              CALL CHRCHR (TLEN-1,TBUFF(J,1),CSOPT(1,I))
            END IF
 28       CONTINUE
          BODOPT= CVAL(20,1,1)
          GO TO 100
C
 30     CONTINUE
C         print/plot options
          SCNAME= 'Plot - number of (EFGP)'
          CALL QEPRPL (MESSFL,NUMRCH,SCNAME,MXPLT,MXRCH,
     M                 NUMPLT,PLTSTR,PLTRCH)
          GO TO 100
C
 40     CONTINUE
C         computational options
 44       CONTINUE
C           loop back here if user selects 'prev' from 2nd screen
            DO 46 I= 1,7
              CVAL(I,1,1)= NPOPT(I)
 46         CONTINUE
            CVAL(8,1,1)= PCIVL(1)
C           save current value of trap x-section option
            TMPOPT= NPOPT(5)
            RNUM= 1
            CNUM= 9
            SGRP= 9
            CALL QRESPM (MESSFL,SCLU,SGRP,I1,RNUM,CNUM,
     M                   IVAL,PCRVL(13),CVAL,TBUFF)
            DO 48 I= 1,7
              NPOPT(I) = CVAL(I,1,1)
 48         CONTINUE
            PCIVL(1)= CVAL(8,1,1)
            PCIVL(3)= CVAL(9,1,1)
C
C           get user exit command
            CALL ZGTRET(IRET)
            IF (NPOPT(5).NE.TMPOPT .AND. IRET.EQ.1) THEN
C             may want to modify trapezoidal data
              DO 49 I= 1,NUMRCH
                DAT5(1,I)= DAT2(1,I)
 49           CONTINUE
              RNUM= 6
              SGRP= 9+ NPOPT(5)+ (2* METFLG)
              CALL QRESCN (MESSFL,SCLU,SGRP,I1,RNUM,I1,NUMRCH,I1,
     M                     IVAL,DAT5,CVAL,TBUFF)
C             get user exit command
              CALL ZGTRET (IRET)
            ELSE IF (IRET.EQ.2) THEN
C             reset exit command value
              IRET= 1
            END IF
          IF (IRET.EQ.2) GO TO 44
          GO TO 100
C
 50     CONTINUE
C         initial conditions
          SCNAME= 'DO/BOD-1 (EFGD)'
          DO 55 I= 1,NUMRCH
            DAT7(1,I) = DAT2(1,I)
            DAT7A(1,I)= DAT2(1,I)
 55       CONTINUE
          CALL QEINCO (MESSFL,NUMRCH,METFLG,SCNAME,
     M                 DAT7,DAT7A)
          GO TO 100
C
 60     CONTINUE
C         A, N, P parameters
          SCNAME= 'ANP (EFGA)'
          CALL QEGANP (MESSFL,METFLG,SCNAME,
     M                 GPARM)
          GO TO 100
C
 70     CONTINUE
C         flow augmentation
          SCNAME= 'Flow (EFGF)'
          DO 75 I= 1,NUMRCH
            DAT3R(1,I)= DAT2(1,I)
 75       CONTINUE
          CALL QEFLAU (MESSFL,NUMRCH,SCNAME,
     M                 DAT3I,DAT3R)
          NPOPT(3)= 2
          DO 78 I= 1,NUMRCH
            IF (DAT3I(I).GT.0) NPOPT(3)= 1
 78       CONTINUE
          GO TO 100
C
 80     CONTINUE
C         all done
          GO TO 100
C
 100    CONTINUE
C
      IF (RESP.NE.8) GO TO 5
C
      RETURN
      END
