     	SUBROUTINE LPRINT
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY, FEB-1987
C
C	THIS ROUTINE WRITES OUT AN ASCII LIST FILE,
C	FROM THE COMMON BLOCKS, READY TO BE DUMPED
C	ONTO THE LINE PRINTER.
C
     	INCLUDE 'FILECONV.CBS'
     	CHARACTER DAY*9, TIM*8

     	CLOSE( UNIT=IOUT )
     	OPEN( UNIT=IOUT, FILE=FILOUT, STATUS='UNKNOWN',
     	1 CARRIAGECONTROL='LIST', FORM='FORMATTED', ERR=888 )
C
C  WRITE THE HEADER INFORMATION...
C
     	CALL CODDAT( DAY, DATM )
     	CALL CODTIM( TIM, TIMM )

     	WRITE(IOUT,1)
1	FORMAT(/X,80('=')/5X,'FORMAT --- An Integrated File Format',
     	1' Conversion Routine        VS:2.87'/X,80('='))

     	WRITE(IOUT,2) NAME, FILINP, (SLID(I),I=1,17), DAY, TIM,
     	1 ANODE(IELE), (WAVE(I,IELE),I=1,5), DANG(1), DANG(2),
     	1 DANG(3), DANG(10)
2	FORMAT(/
     	1' USER NAME: ',3A4,/
     	1' FILE NAME: ',A32,/
     	1' SAMPLE ID: ',17A4,/
     	1' RUN  DATE: ',A9,';   RUN  TIME: ',A8,/
     	1' ANODE: ',A2,', KA1=',F7.4,', KA2=',F7.4,', KA=',F7.4,
     	1', KB1=',F7.4,', KA1/KA2=',F5.2,//
     	1' STARTING ANGLE=',F7.3,'  ENDING ANGLE=',F7.3,
     	1'  STEPSIZE=',F7.3,'  C.T.(SEC)=',F4.1,/,X,80('-'))

     	IF( ITYI.NE.1 ) GOTO 111
C
C  WRITE OUT THE RAW PATTERN...
C
     	WRITE(IOUT,1000)
1000	FORMAT(22X,'P A T E R N   L I S T  (CPS)'/,X,80('-'))
     	WRITE(IOUT,1001) ( INT(YOBS(I)/DANG(10)), I=1, NPTS )
1001	FORMAT(10(I7,X))
     	WRITE(IOUT,1002)
1002	FORMAT(X,80('-'))
     	GOTO 999

111	IF( ITYI.NE.2 ) GOTO 999
C
C  WRITE OUT THE DIFILE...
C
     	WRITE(IOUT,2000)
2000	FORMAT(' #TH    2-THETA(O,C)     D(O)',
     	1'    D(C)  REL.INT  AREA        FWHM   H  K  L TYPE'/X,80('-'))
     	WRITE(IOUT,2001) (I, F2TH(I), C2TH(I), FDSP(I), CDSP(I), RELA(I),
     	1 AREA(I,JRES), FWHM(I), (PHKL(J,I),J=1,3), PEAK(I), I=1, NPKS)
2001	FORMAT(X,I3,2X,F7.3,X,F7.3,2X,F7.4,X,F7.4,2X,F5.1,X,G11.5,2X,
     	1 F5.2,X,3I3,X,A4)
     	WRITE(IOUT,1002)
     	GOTO 999

888	IERR= 1
999	RETURN
     	END
