      SUBROUTINE MKFORM_DEPTH(FIELDS,NFIELDS,NVAR,FORMH)
C
C     MAKE THE FORMAT FOR THE SECOND HEADER RECORD
C
      CHARACTER FORMH*(*),FIELDS(50)*10,FLDTYPE*1
      LOGICAL LOOP
C
      NHEAD=1
      NERR=0
      NFOUT=0
      NCOUT=0
      FORMH=' '
C
      NX=ISPCTIM(FIELDS,NF,NERR)
      IF(NF.LE.NFIELDS.AND.NERR.EQ.0)THEN
           NX=NX-5
           NC=ALOG10(FLOAT(NX))+1
           NCOUT=NC+10
           WRITE(FORMH(1:NCOUT),100)NX
  100      FORMAT('(''DEPTH'',',I<NC>,'X')
C
           NC1=NCOUT+1
           IF=NF
           DO WHILE (IF.LT.NFIELDS.AND.NFOUT.LT.NVAR)
                NX=0
                LOOP=.TRUE.
                DO WHILE(LOOP)
                     IF=IF+1
                     IF(IF.GT.NFIELDS)THEN
                          LOOP=.FALSE.
                          FORMH='*'
                          RETURN
                     ELSE     
                          NX=NX+IFLDLEN(FIELDS(IF),FLDTYPE,NERR)
                          IF(NERR.EQ.0)THEN
                               IF(FLDTYPE.NE.'X'.AND.FLDTYPE.NE.'I')
     -                          THEN
                                    LOOP=.FALSE.
                                    NC=ALOG10(FLOAT(NX))+1
                                    NCOUT=NCOUT+NC+4
                                    NFOUT=NFOUT+1
                                    WRITE(FORMH(NC1:NCOUT),200)NX
  200                               FORMAT(',F',I<NC>,'.1')
                                    NC1=NCOUT+1
                               ENDIF
                          ELSE
                               FORMH='*'
                               RETURN
                          ENDIF
                     ENDIF
                ENDDO
           ENDDO
           IF(FORMH.NE.'*')FORMH(NC1:NC1)=')'
      ENDIF
C
      IF(NFOUT.NE.NVAR.OR.NERR.EQ.1)THEN
           FORMH='*'
      ENDIF
      RETURN
      END
