     	SUBROUTINE WDINIC
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY   FEB-1987
C
C	THIS ROUTINE WRITES OUT A NICOLET DIFILE
C	FROM THE COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	INTEGER*2 IBUF(149), HKLP(3,150), IDUM, NOD
     	DIMENSION FWAVE(3)
     	EQUIVALENCE (IBUF(1),SLID(1)), (IBUF(47), FWAVE(1))

     	CLOSE( UNIT=IOUT )
     	OPEN( UNIT=IOUT, FILE=FILOUT, STATUS='NEW',
     	1 FORM='UNFORMATTED', ERR=888 )

     	FWAVE(1) = WAVE(3,IELE)
     	FWAVE(2) = WAVE(1,IELE)
     	FWAVE(3) = WAVE(2,IELE)
C
C  WRITE THE HEADER INFORMATION...
C
     	WRITE(IOUT,ERR=888) IBUF
C
C  WRITE THE PEAK INFORMATION...
C
     	DO I=1, NPKS
     	   HKLP(1,I) = PHKL(1,I)
     	   HKLP(2,I) = PHKL(2,I)
     	   HKLP(3,I) = PHKL(3,I)
     	ENDDO
     	IDUM = 0
     	NOD = NPKS
     	WRITE(IOUT,ERR=888) NOD, ( FDSP(I), RELA(I), F2TH(I),
     	1 FWHM(I), (HKLP(J,I),J=1,3), IDUM, I=1, NOD )
     	GOTO 999

888	IERR = 1
999	RETURN
     	END
