     	SUBROUTINE WDISPP
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY   FEB-1987
C
C	THIS ROUTINE WRITES OUT A SPECPLOT DIFILE
C	FROM THE COMMON BLOCKS
C                                                                            
     	INCLUDE 'FILECONV.CBS'
     	INTEGER*4 SNUM, DATE, YEAR

     	CLOSE( UNIT=IOUT )
     	OPEN( UNIT=IOUT, FILE=FILOUT, STATUS='NEW',
     	1 FORM='FORMATTED', CARRIAGECONTROL='LIST', ERR=888 )
C
C  WRITE THE FILE HEADER...
C
     	SNUM = 1		!????
     	DATE = INT(DATM*1.0E-4)
     	MONT = INT(DATM*1.0E-2) - DATE*100
     	YEAR = INT(DATM*1.0E-0) - DATE*10000 - MONT*100
     	MONT = (MONT-1)/3 + 1
     	WRITE(IOUT,1000,ERR=888) SNUM,MONT,DATE,YEAR,(SLID(I),I=1,12)
1000	FORMAT(1X,I5,1X,I2,'-',I2,'-',I2,1X,'DI  ',4X,12A4)
     	WRITE(IOUT,1001,ERR=888) DANG(1),DANG(3),DANG(10),
     	1 ANODE(IELE), WAVE(1,IELE)
1001	FORMAT(' START ANGLE=',F8.3,'  DELTA 2THETA=',F6.3,
     	1'  TIME=',F5.1,' TUBE=',A2,' LAMDA=',F6.3,///
     	1'   N   2THETA   DSPACE  (1/D**2)  HEIGHT     AREA'/)
C
C  WRITE THE D-SPACING AND THE INTENSITY DATA...
C
     	WRITE(IOUT,2000,ERR=888) (I,F2TH(I),FDSP(I),1.0/FDSP(I)**2,
     	1 PHGH(I), AREA(I,1), I=1, NPKS)
2000	FORMAT(I4,F9.3,2F9.4,2F9.1)
     	GOTO 999
888	IERR = 1
999	RETURN
     	END
