C   14/12/79 912140748  MEMBER NAME  @LGPROD  (SOURCE)      FORTRAN
C
C    S.YAMADA   09-03-79  10:25
C     LAST MODIFICATION   09-03-79  23:25
C
C---- SIMPLE TEST PROGRAM FOR LGANAL FOR REAL DATA.
C
C
      IMPLICIT INTEGER *2 (H)
C
      COMMON /BCS/ IDATA(24000)
      DIMENSION  ADATA(24000),HDATA(48000)
      EQUIVALENCE (IDATA(1),ADATA(1)), (HDATA(1),IDATA(1))
C
      COMMON /CLGMSB/ MSGVAL(5)
C
C---- INITIALIZATION
      DATA NUNITO,RPATR,RHEAD,RALGN,RLGCL/2,4HPATR,4HHEAD,4HALGN,4HLGCL/
      CALL BINT(24000,4000,500,0)
      CALL BINT1(200,100,10,0)
      CALL BWRO( NUNITO, 1558, 2)
C
      CALL LGINIT
C
        DO 1000 N=1,99999
        NTIM=JUHR(2)
        IF(NTIM.EQ.2) GO TO 300
C
        DATA NUNITI/1/
        CALL BREAD(NUNITI,&200,&200)
          IPNPHD = IBLN(RHEAD)
          NPHD = IDATA(IPNPHD)
          IF(NPHD.LE.0) GO TO 20
          NHPHD = NPHD+NPHD
C         HEXP=HDATA(NHPHD+ 9)
C         HRUN=HDATA(NHPHD+10)
C
          IPP = IBLN(RPATR)
          NPPR = IDATA(IPP)
        CALL LGANAL
C
C----   SECOND STEP ANALYSIS
C       POINTERS OF THE NECESSARY BANKS
        NPR = 0
        NPCL = 0
C----   SHIFT NPPATR BY 1 TO SKIP THE BANK-DESCRIPTER WORD IF IT'S THERE
        CALL CLOC( NPR,    RALGN,1)
        CALL CLOC( NPCL,   RLGCL,1)
        IF(NPCL) 90,90,10
C
C----   SOME BANK IS MISSING
   90   MSGVAL(1) =  NPPR
        MSGVAL(2) =  NPR
        MSGVAL(3) =  NPCL
        CALL LGMESG( 1, 2 )
        GO TO 20
C
   10   CALL LGCDIR( NPPR, NPR, NPCL )
20      CONTINUE
        CALL BSLW
        CALL BWRITE(NUNITO)
        CALL BSLT
        CALL BDLG
C
 1000   CONTINUE
      GO TO 100
  200 MSGVAL(1) = N
      CALL LGMESG( 1,1 )
      GO TO 100
300   WRITE(6,6200) N,(HDATA(HNPHD+J),J=9,11)
6200  FORMAT(' TIME OUT AT REC#,EXP#,RUN#,EV#',10I6)
100   CONTINUE
      CALL BMLT(0,DUMMY)
      CALL BWRITE(NUNITO)
      CALL BSLT
      CALL BDLG
      STOP
      END
