C   07/06/96 606071850  MEMBER NAME  ILINK    (S4)          FORTG1
      FUNCTION ILINK(NAME,NR)
C
C     BAS05     FUNCTION ILINK  /  VERSION FOR F1EBLO.BOSLIB.S/L
C
C     ILINK RETURNS THE INDEX OF THE BANK (NAME,NR) OR ZERO
C
C               ---- --
C     IND=ILINK(NAME,NR)
C     ---
C
C     IND=INDEX TO BANK (NAME,NR), IF THE BANK EXISTS
C     IND=0 OTHERWISE (IN THIS CASE THE NAME IS NOT ADDED TO THE
C     INTERNAL LIST (SEE IBLN)
C
C     --------------------------------------------------------------
      COMMON/ACS/
     1   ICOND,NLAST,NDUMP,NSPL,NAMAX,NAMAX1,NLIST,NPRIM,NFRS,NLST,
     2   NEXT,NCI,NFRE,IN,KPOS,LIND,ILOW,LFDI,LFDK,NCPL,
     3   NHISTH(11),
     4        NCOL,NZT,IBFI,NLAST1,ISLST,IMLST,INAMV,IOLST,IPLST,
     5   NER(10),
     6   NRECL,NERRL,NRIN,NROUT,NS,NEXTI,NEXTA,NEXTB,ISAVB,NSAVB,
     7   NHISTL(11),
     8        MARKWR,NOUT(3),IASW,NPRE,IDUMMY(1),NEOTP,NDUMP1,
     9   JNAM,NLK,NLM,ILKNA,ILKIN,ILKND,LKNAME,LKNR,ICUST,IREV,
     *   NUNTB,DUMMY(9)
C     --------------------------------------------------------------
      COMMON/BCS/IW(1)
C     --------------------------------------------------------------
      ILINK=0
      LKNAME=NAME
      LKNR  =NR
C
C     REDUCE LOOPS, IF PREVIOUS BANK IS NEAR PRESENT BANK
C
C  20 IF(JNAM.EQ.0.OR.IW(INAMV+JNAM).NE.NAME) GOTO 21
C     IF(LFDI.EQ.0)      GOTO 23
C     IF(IW(LFDI-2)-NR) 24,25,23
C
C     LOOP TO FIND INDEX TO NAME (INLINE IBLN)
C
   21 IW(INAMV)=NAME
      JNAM=MOD(IABS(NAME),NPRIM)+NAMAX1
   22 JNAM=IW(JNAM+IPLST)
      IF(IW(JNAM+INAMV).NE.IW(INAMV)) GOTO  22
      IF(JNAM.EQ.0)                   GOTO 100
C
C     LOOP TO FIND BANK WITH NUMBER NR
C
   23 LFDI=JNAM+1
   24 LFDK=LFDI
      LFDI=IW(LFDI-1)
      IF(LFDI.EQ.0)      GOTO 100
      IF(IW(LFDI-2)-NR) 24,25,100
C
C     INDEX TO BANK FOUND
C
   25 ILINK=LFDI
  100 RETURN
      END
