*
* $Id$
*
* $Log$
* Revision 1.2  1999/06/18 13:30:40  couet
* - qcardl.inc was empty: It is now removed and not used.
*   Comment END CDE removed.
*
* Revision 1.1.1.1  1996/03/06 10:47:22  mclareni
* Zebra
*
*
#include "zebra/pilot.h"
      FUNCTION LZFID (IXDIVP,IDHP,IDNP,LGOP)

C-    Find first bank with IDH/IDN in div. IXDIV after bank at LGO
C-    user called

#include "zebra/mqsys.inc"
#include "zebra/mzcn.inc"
*
      DIMENSION    IXDIVP(9), IDHP(9), IDNP(9), LGOP(9)
#if (defined(CERNLIB_QTRHOLL))&&(!defined(CERNLIB_A6M))
      DIMENSION    NAMESR(2)
      DATA  NAMESR / 4HLZFI, 4HD    /
#endif
#if (defined(CERNLIB_QTRHOLL))&&(defined(CERNLIB_A6M))
      DATA  NAMESR / 6HLZFID  /
#endif
#if !defined(CERNLIB_QTRHOLL)
      CHARACTER    NAMESR*8
      PARAMETER   (NAMESR = 'LZFID   ')
#endif

#include "zebra/q_jbit.inc"

      IXIN = IXDIVP(1)
      IDH  = IDHP(1)
      IDN  = IDNP(1)
      LGO  = LGOP(1)

      CALL MZSDIV (IXIN,4)
      LSTA = LQSTA(KQT+JQDIVI)
      IQNX = LSTA
      LEND = LQEND(KQT+JQDIVI)

      IF (LGO.EQ.0)                GO TO 31

      IF (LGO.LT.LSTA)             GO TO 91
      IF (LGO.GE.LEND)             GO TO 91

      CALL MZCHLS (-7,LGO)
      IF (IQFOUL.NE.0)             GO TO 92

   31 LN   = IQNX
      IF (LN.GE.LEND)              GO TO 39
      CALL MZCHLN (-7,LN)
      IF (IQFOUL.NE.0)             GO TO 93
      IF (IQND.LT.0)               GO TO 31
      IF (IQ(KQS+IQLS-5).NE.IDN)           GO TO 31
      IF (IQID.NE.IDH)             GO TO 31
      IF (JBIT(IQ(KQS+IQLS),IQDROP).NE.0)  GO TO 31
      LZFID = IQLS
      RETURN

   39 LZFID = 0
      RETURN

C------            ERROR CONDITIONS

   93 NQCASE = 1
      NQFATA = 1
      IQUEST(17) = LN
   92 NQCASE = NQCASE + 1
   91 NQCASE = NQCASE + 1
      NQFATA = NQFATA + 6
      IQUEST(11) = IXIN
      IQUEST(12) = IDH
      IQUEST(13) = IDN
      IQUEST(14) = LGO
      IQUEST(15) = LSTA
      IQUEST(16) = LEND
#include "zebra/qtrace.inc"
#include "zebra/qtofatal.inc"
      LZFID = 0
      END
