      IF(ID(1:2) .EQ. 'C0') THEN
        DO J=25,32
          IF(DLIN(J:J) .EQ. '/') THEN
            DLIN(J:J)=','
            READ(DLIN(1:24),'(3I8)') IOPTZD,IDNOPT,IYRR
            READ(DLIN(25:32),*) ITMD,ITMM
            DAYOFY=IMTS(ITMM)+ITMD
            IF(MOD(IYRR,4) .EQ. 0   .AND.  ITMM .GT. 2) DAYOFY=DAYOFY+1
            READ(DLIN(33:72),'(F8.0,I8,2F8.0,I8)')TET,IEDSW,TBFACT,TBMIN
     +     ,IPROJ
            GO TO 60
          ENDIF
        ENDDO
      
        READ(DLIN,5061)IOPTZD,IDNOPT,IYRR,DAYOFY,TET,IEDSW,TBFACT,TBMIN
     +  ,IPROJ

        write(*,*) 'read c0'
CIPK FEB04 SAVE TIMES IN CASE IOV ACTIVE
   60   CONTINUE 
	  IYKK=IYRR
        IDTM=DAYOFY
        TTEM=TET
        GO TO 50
cipk end changes apr 96
      ELSEIF(ID(1:2) .EQ. 'C1') THEN
CIPK SEP05
        ISAVITR=0
cipk FEB15  allow zero bed option to be based on a level      
        READ(DLIN,5021) 
     +  NDP,IGRV,IZB,IPASS1,IPASS2,IPASS3,IZERS,ISAVITR,zerbed
 5021   FORMAT(8I8,F8.0)      
cipk mar15 add switch for density distribution
        read(dlinextra,'(i8)') ivertden
	
        GO TO 50        
        
      ELSEIF(ID(1:2) .EQ. 'C2') THEN
CIPK DEC07 REPLACE OMEGA BY OMEGA1      
        READ(DLIN,5020) OMEGA1,ELEV,XSCALE,YSCALE,ZSCALE
        write(*,*) 'read c2'
        GO TO 50

      ELSEIF(ID(1:2) .EQ. 'C3') THEN

        READ(DLIN,5020) CMIN,CPR,UNOM,UDIR,HMNN,DSET,DSETD,IFXBC,IEQSWT
CIPK NOV97      READ(LIN,7000) ID,DLIN
        GO TO 50

      ELSEIF(ID(1:2) .EQ. 'C4') THEN

cipk sep96 add to 3 lines below for ocean exchange percentantage and mixing
        READ(DLIN,5020) SALI,TEMPI,SEDI,UINP,VINP,prcnt,DMIX
        write(*,*) 'read c4'
        GO TO 50
      
      ELSEIF(ID(1:2) .EQ. 'C5') THEN

        READ(DLIN,5011) NITI,NITN,TSTART,NCYC,IPRT,NPRTI
     +  ,NPRTF,IRSAV,IDSWT
        write(*,*) 'read c5'
C
      

        GO TO 50

      ELSEIF(ID(1:2) .EQ. 'C6') THEN
      
CIPK APR11
        READ(DLIN,'(8I8)') IOUTFREQ,IOUTRST,IREWOUT,ID1DND,ICPU,IOOC
     +   ,IREWMES,IDEBUG
CIPK JAN09
 
        GO TO 50
        
CIPK AUG11  add logic to allow exclusion whenID1DND = 3 or 4
   16 ELSEIF(ID(1:3) .EQ. 'EXM') THEN

	  READ(DLIN,'(9I8)') (MDLIST(I),I=1,9)
        DO I=1,9
	    IF(MDLIST(I) .GT. 0) THEN
	      IDEXCL(MDLIST(I))=1
	    ENDIF
        ENDDO
        GO TO 50
      
      ELSEIF(ID(1:3) .EQ. 'INI') THEN
      
        READ(DLIN,'(F8.0)') ELEV1
 
        GO TO 50

      ELSEIF(ID(1:3) .EQ. 'VLA') THEN
      
        READ(DLIN,'(F8.0)') YLATREF
        IVL=1
 
        GO TO 50

      ELSEIF(ID(1:4) .EQ. 'RMA2') THEN
        IRMA2=1
        GO TO 50

      ELSEIF(ID(1:2) .EQ. 'CV') THEN
        READ(DLIN,'(6F8.0,i8,f8.0)') (CONV(J),J=1,6),idrpt,drfact
        GO TO 50

      ELSEIF(ID(1:3) .EQ. 'IOV') THEN
        IOV=1


cipk feb97 add line to select optimisation
        GO TO 50

      ELSEIF(ID(1:3) .EQ. 'IOP') THEN
        READ(DLIN,'(F8.2)') W2FACT
        IOPTIM=0

        GO TO 50

      ELSEIF(ID(1:5) .EQ. 'DFACT') THEN
        READ(DLIN,'(3F8.2,I8)') DFACTIN1,DFACTIN2,DFACTIN3,INEWDEN

        
        GO TO 50

      ELSEIF(ID(1:4) .EQ. 'ICE1') THEN
        READ(DLIN,'(8F8.0,i8)')ROW,CHEAT,TMED,HTR,XLAT,ROSN,ROIC,TICE,
     +	  ICESW
        GO TO 50

      ELSEIF(ID(1:4) .EQ. 'ICE2') THEN
        READ(DLIN,'(5F8.0)') CAL1,CAL2,CAL3,CAL4,VTR
        call ginpt(lin,id,dlin)
        GO TO 50
      
      ELSEIF(ID(1:3) .EQ. 'COL') THEN
        READ(DLIN,'(F8.2)') TRANSIT
        ITRANSIT=1
cipk revised unit
        GO TO 50
      
      ELSEIF(ID(1:3) .EQ. 'TST') THEN
        READ(DLIN,'(I8,2F8.0)') NODETR,TRELEV,TRFACT


        GO TO 50

      ELSEIF(ID(1:3) .EQ. 'PWR') THEN
        READ(DLIN,'(2I8,2F8.0,I8,3F8.0,I8)') NINCC,NOUTCC(NINCC),
     +      ADDSAL(NINCC),ADDTMP(NINCC,1),IPWRSW(NINCC),ADDTMP(NINCC,3)
     +     ,ADDSED(NINCC),ADDMAX(NINCC),NADTYP(NINCC)
        GO TO 50

      ELSEIF(ID(1:3) .EQ. 'EQT') THEN
        READ(DLIN,'(3F8.0)') EQTEMP,XKRAT,EXTING
        GO TO 50

      ELSEIF(ID(1:6) .EQ. 'BEDMIN') THEN
        READ(DLIN,'(F8.0)') BEDMIN
        GO TO 50

      ELSEIF(ID(1:6) .EQ. 'BEDMAX') THEN
        READ(DLIN,'(F8.0)') BEDMAX
        GO TO 50

      ELSEIF(ID(1:8) .EQ. 'BEDSHIFT') THEN
        READ(DLIN,'(F8.0)') BEDSHIFT
        GO TO 50

      ELSEIF(ID(1:8) .EQ. 'FLOWSCAL') THEN        
        READ(DLIN,'(F8.0)') FLOWSCAL
        GO TO 50

CIPK AUG10   ADD SETTLING FOR SEDIMENT 
      ELSEIF(ID(1:4) .EQ. 'VSET') THEN
        READ(DLIN,'(3F8.0)') VSET,VDECAY,PRECIP      
        GO TO 50

CIPK AUG10   ADD BED HEAT TRANSFER 
      ELSEIF(ID(1:4) .EQ. 'BDHT') THEN
        IBEDHT=1
        READ(DLIN,'(5F8.0)')TGL,DLINER,XKL,DDRY,XKG
        GO TO 50

      ELSEIF(ID(1:3) .EQ. 'CHI') THEN
        READ(DLIN,'(F8.0)') CHI1
        GO TO 50

      ELSEIF(ID(1:3) .EQ. 'SPC') THEN
        READ(DLIN,'(9A8)') (ASPLPT(J),J= 1,8)
        ITOTC=0
        DO J=1,8
          IF(ASPLPT(J) .EQ. 'VELOCITY') THEN
            ICOMP(ITOTC+1)=-1
            ITOTC=ITOTC+1
          ELSEIF(ASPLPT(J) .EQ. 'DEPTH   ') THEN
            ICOMP(ITOTC+1)=3
            ITOTC=ITOTC+1
          ELSEIF(ASPLPT(J) .EQ. 'WS-ELEV ') THEN
            ICOMP(ITOTC+1)=7
            ITOTC=ITOTC+1
          ELSEIF(ASPLPT(J) .EQ. 'SALINITY') THEN
            ICOMP(ITOTC+1)=4
            ITOTC=ITOTC+1
          ELSEIF(ASPLPT(J) .EQ. 'TEMPERAT') THEN
            ICOMP(ITOTC+1)=5
            ITOTC=ITOTC+1
          ELSEIF(ASPLPT(J) .EQ. 'SEDIMENT') THEN
            ICOMP(ITOTC+1)=6
            ITOTC=ITOTC+1
          ENDIF
        ENDDO
        GO TO 50
        
      ELSEIF(ID(1:3) .EQ. 'SP ') THEN
        READ(DLIN,5010) (NSPLPT(J),J= 1,9)
        READ(DLINEXTRA,'(I8)') NSPLPT(10)
        DO J=10,1,-1
          IF(NSPLPT(J) .GT. 0) THEN
            JSPLPT=J
            GO TO 22
          ENDIF
        ENDDO
   22   CONTINUE
        GO TO 50

      ELSEIF(ID(1:4) .EQ. 'CSPC') THEN
        READ(DLIN,'(9A8)') (ACSPLPT(J),J= 1,8)
        ICTOTC=0
        DO J=1,8
          IF(ACSPLPT(J) .EQ. 'FLOW    ') THEN
            ICCOMP(ICTOTC+1)=1
            ICTOTC=ICTOTC+1
          ELSEIF(ACSPLPT(J) .EQ. 'DEPTH   ') THEN
            ICCOMP(ICTOTC+1)=2
            ICTOTC=ICTOTC+1
          ELSEIF(ACSPLPT(J) .EQ. 'WS-ELEV ') THEN
            ICCOMP(ICTOTC+1)=3
            ICTOTC=ICTOTC+1
          ELSEIF(ACSPLPT(J) .EQ. 'SALINITY') THEN
            ICCOMP(ICTOTC+1)=4
            ICTOTC=ICTOTC+1
          ELSEIF(ACSPLPT(J) .EQ. 'TEMPERAT') THEN
            ICCOMP(ICTOTC+1)=5
            ICTOTC=ICTOTC+1
          ELSEIF(ACSPLPT(J) .EQ. 'SEDIMENT') THEN
            ICCOMP(ICTOTC+1)=6
            ICTOTC=ICTOTC+1
          ENDIF
        ENDDO
        GO TO 50

CIPK AUG11
      ELSEIF(ID(1:4) .EQ. 'CSP ') THEN
        READ(DLIN,5010) (NCSPLPT(J),J= 1,9)
        READ(DLINEXTRA,'(I8)') NCSPLPT(10)
        DO J=10,1,-1
          IF(NCSPLPT(J) .GT. 0) THEN
            JCSPLPT=J
            GO TO 23
          ENDIF
        ENDDO
   23   CONTINUE
        GO TO 50
      ELSEIF(ID(1:3) .EQ. 'ED1') THEN
        READ(DLIN,5030) J,(ORT(J,K),K=1,7)
        write(*,*) 'read ed1'

        IF(NMAT .LT. J) NMAT=J
        GO TO 50
CIPK NOV97      READ(LIN,7000) ID,DLIN
      ELSEIF(ID(1:3) .EQ. 'ED2') THEN
        READ(DLIN,5031) (ORT(J,K),K=8,13)
        write(*,*) 'read ed2'
cipk mar98 
        GO TO 50  
  	ELSEIF(ID(1:3) .EQ. 'ED3') THEN
        if(IEDSW .EQ. 5) THEN
          READ(DLIN,5031) ELDER(J,1),ELDER(J,2)
        ELSE    	    
          READ(DLIN,5032) IT1,TT1,TT2
	    IF(TT1 .GT. 0.) THEN
            TBFACT1(J)=TT1
	    ENDIF
	    IF(TT2 .GT. 0.) THEN
	      TBMIN1(J)=TT2
          ENDIF
        ENDIF
        GO TO 50
cipk mar07 add to test            
      ELSE
        GO TO 24
      ENDIF
