      SUBROUTINE QEHEAD
     I                  (MESSFL,NUMHDW,METFLG,SCNAME,
     M                   HDWNAM,DAT10,DAT10A)
C
C     + + + PURPOSE + + +
C     modify headwater data
C
C     + + + DUMMY ARGUMENTS + + +
      INTEGER     MESSFL,NUMHDW,METFLG
      REAL        DAT10(8,NUMHDW),DAT10A(10,NUMHDW)
      CHARACTER   SCNAME*(*)
      CHARACTER*1 HDWNAM(16,NUMHDW)
C
C     + + + ARGUMENT DEFINITIONS + + +
C     MESSFL - Fortran unit number for message file
C     NUMHDW - number of headwaters
C     METFLG - flag indicating English or Metric units
C     SCNAME - screen name to appear in upper left corner
C     HDWNAM - array of headwater names
C     DAT10  - array of data for headwater data-1
C     DAT10A - array of data for headwater data-2
C
C     + + + LOCAL VARIABLES + + +
C-DWD
C-DWD ##### Begin change ############################
C-DWD Date: Tuesday, 29 October 1991.  Time: 16:28:07.
C-DWD -----------------------------------------------
C-DWD Modified parameter values to match QUAL2E MAIN.VAR file.
C-DWD
C      INTEGER      I,I1,SCLU,SGRP,IRET,IPOS,LEN,RNUM,
C     1             IVAL(1,10),CVAL(1,3,10)
C      CHARACTER*1  TBUFF(80,10),BLNK,DASH
      INTEGER      I,I1,SCLU,SGRP,IRET,IPOS,LEN,RNUM,
     1             IVAL(1,20),CVAL(1,3,20)
      CHARACTER*1  TBUFF(80,20),BLNK,DASH
C-DWD
C-DWD ##### End change ##############################
C
C     + + + INTRINSICS + + +
      INTRINSIC    INDEX
C
C     + + + EXTERNALS + + +
      EXTERNAL     QRESCX, QRESCN, ZGTRET, CHRCHR, ZIPC, ZWNSET
C
C     + + + END SPECIFICATIONS + + +
C
      I1  = 1
      BLNK= ' '
      DASH= '-'
      SCLU= 10
C
 11   CONTINUE
C       loop to here if 'prev' selected on 2nd screen
        CALL ZWNSET (SCNAME)
        I= 80* NUMHDW
        CALL ZIPC (I,BLNK,TBUFF)
        RNUM= 8
        SGRP= 2+ METFLG
        DO 14 I= 1,NUMHDW
          LEN  = 16
          CALL CHRCHR(LEN,HDWNAM(1,I),TBUFF(6,I))
 14     CONTINUE
        CALL QRESCX (MESSFL,SCLU,SGRP,I1,RNUM,I1,NUMHDW,I1,
     M               IVAL,DAT10,CVAL,TBUFF)
C
C       get user exit command
        CALL ZGTRET (IRET)
        IF (IRET.EQ.1) THEN
C         user selected 'next', group data10a, form 18
          IPOS= INDEX (SCNAME,DASH)+ 1
          SCNAME(IPOS:IPOS)= '2'
          CALL ZWNSET (SCNAME)
          DO 18 I= 1,NUMHDW
            DAT10A(1,I)= DAT10(1,I)
18        CONTINUE
          RNUM= 10
          SGRP= 4
          CALL QRESCN (MESSFL,SCLU,SGRP,I1,RNUM,I1,NUMHDW,I1,
     M                 IVAL,DAT10A,CVAL,TBUFF)
C         get user exit command
          CALL ZGTRET (IRET)
          IF (IRET.NE.1) SCNAME(IPOS:IPOS)= '1'
        ELSE
C         reset user exit command
          IRET= 1
        END IF
      IF (IRET.EQ.2) GO TO 11
C
      RETURN
      END
