	SUBROUTINE OUTPUT
C
	IMPLICIT LOGICAL*1 (B)
	DOUBLE PRECISION SYMBOL
	COMMON/PARAMS/LUNIN,LUNOUT,LUNCMD,BTAB,BSPC,NLINE,NSTMT,
	1ICLASS,BCHR,BLST,JSYM(2),NSYMTP,IPARNS,NPAGE
	COMMON /INBUFR/INSIZ,INCNT,IOUTX,MCRSIZ,INFIL,IOUTFL,
	1BDPB(2),BUFR(80),BNAM(24),BTIME(8),BDATE(9),BX(1)
	COMMON NSYM,NELM,KLIM,SYMBOL(1000)
C
C
	DIMENSION INDX(401),IKEY(31),BSYM(6),IKEY0(2)
	EQUIVALENCE (IKEY0(2),IKEY(1))	!CREATE ZEROITH ELEMENT OF IKEY
	DATA IKEY0/2H@ ,2H= /
	DATA IKEY /2H= ,2HAS,2HIU,2HPD,2HDT,2HCA,2HID,2HCM,2HDA,
	12HED,2HDF,2HDI,2HDO,2HEN,2HXP,2HEQ,2HGO,2HIF,2HIN,2HPM,
	22HIO,2HIO,2HX1,2HX2,2HX3,2HX4,2HX5,2HX6,2HPS,2HXX,2H  /
	DATA IMAX/200/
	CALL FRMCTL(0)
	WRITE(LUNOUT,80)		!PRINT HEADER
	CALL FRMCTL(3)
C
C  NOW PRINT SYMBOL TABLE
C
	DO 40 J=1,NSYM
	CALL GETSYM(SYMBOL(J),JSYM,INDX,ICNT,IMAX)
	I=1
	IF(ICNT.GT.0)GOTO 5
C
C   IF ICNT .LT. 0,REFERENCES EXCEED LIMIT--INDICATE THIS
C
	ICNT=ICNT*-1		!TURN COUNT POSITIVE
	WRITE(LUNOUT,120)IMAX	!TELL THE WORLD WE LOST SOME REFERENCES
120	FORMAT(' ****** REFERENCES EXCEED ', I3,'******')
	CALL FRMCTL(1)		!COUNT THE LINES
5	IF(INDX(I).EQ.0) GOTO 8
	I=I+1
	INDX(I)=IKEY(INDX(I))
	I=I+1
	GOTO 5
8	IF(JSYM(1).NE.0) GOTO 10
	ENCODE(6,90,BSYM)JSYM(2)
90	FORMAT(I6)
	GOTO 15
10	CALL R50ASC(6,JSYM,BSYM)
15	IL=16
	ICNT=ICNT*2
	IF(IL.GT.ICNT)IL=ICNT
	WRITE(LUNOUT,100)BSYM,(INDX(IO),IO=1,IL)
100	FORMAT(' ',6A1,' - ',8(I4,1X,A2,1X))
	CALL FRMCTL(1)
	IF(ICNT.EQ.IL) GOTO 40
	DO 20 I=IL+1,ICNT,16
	IC=15
	IF(ICNT-I.LT.16)IC=ICNT-I-1
	WRITE(LUNOUT,110)(INDX(IO),IO=I,I+IC)
110	FORMAT(10X,8(I4,1X,A2,1X))
	CALL FRMCTL(1)
20	CONTINUE
40	CONTINUE
	IREF=KLIM-NELM		!FIND NUMBER REFERENCE ELEMENTS USED
	ISPR=NELM-NSYM		!FIND NUMBER SPARE
	WRITE(LUNOUT,130)NSYM,IREF,ISPR
130	FORMAT(' SYM TBL: ',I3,' DEFINITON, ',I3,' REFERENCE ELEMENTS
	1 USED, ',I3,' FREE.')
	NELM=KLIM	!RESET POINTER TO TOP OF TABLE
	NSYM=0		!ZERO SYMBOL COUNT
	RETURN
80	FORMAT('0SYMBOL------REFERENCES------')
	END
