     	SUBROUTINE WDITAG
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY,  FEB-1987
C
C	THIS ROUTINE WRITES OUT A SCINTAG DIFILE
C	FROM THE COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	INTEGER*2 ITIT(40), HH, KK, LL
     	EQUIVALENCE (ITIT,SLID)

     	CLOSE( UNIT=IOUT )
     	OPEN( UNIT=IOUT, FILE=FILOUT, STATUS='NEW',
     	1 FORM='UNFORMATTED', ERR=888 )
C
C  WRITE THE FILE HEADER INFORMATION...
C
     	IDUM = 0
     	DUMY = 0.0
     	WRITE(IOUT,ERR=888) ITIT, DANG(1), DANG(2), DANG(3),
     	1 DANG(10), DUMY, WAVE(1,IELE), (IDUM, I=1,50)
C
C  WRITE THE PEAK LIST...
C
     	DO I=1, NPKS

     	   HH = PHKL(1,I)
     	   KK = PHKL(2,I)
     	   LL = PHKL(3,I)
     	   WRITE(IOUT,ERR=888 ) F2TH(I), DUMY, AREA(I,JRES),
     	1  PHGH(I), FWHM(I), HH, KK, LL

     	ENDDO
     	GOTO 999
888	IERR = 1
999	RETURN
     	END
