*     ****************
      SUBROUTINE EXPUT
*     ****************
*
*     This subroutine outputs the data on disk files.
*
      INTEGER IN(3)
      INCLUDE 'COMMONS.FOR'
      COMMON/DATA/CUT,NREFL,NH(3),IALFA,ISTAP,NCHAN,ICODE(999),
     *       HKL(3,999),SJJ(999),YOBS(15000),WEIGHT(15000),IORD(15000)
      SAVE
      DATA SQRPI/1.7724538509/
*
      IF(YES) THEN
         WRITE(13,1000) NREFL
         DO 20 I=1,NREFL
         DO 10 J=1,3
   10    IN(J)=HKL(J,I)*NH(J)
         MLT=SJJ(I)
         X=BRAGG(I)/100
   20    WRITE(13,1000) ICODE(I),IN,MLT,X,FNUC(I),FMAG(I)
         WRITE(13,1001)
         CLOSE(UNIT=13,STATUS='KEEP')
      END IF
      IF(PUNCH) THEN
         OPEN(UNIT=18,STATUS='NEW',FORM='FORMATTED'
     *        ,CARRIAGECONTROL='LIST'                         ! VAX/VMS
     *        )
         WRITE(18,1000) NREFL
         WRITE(18,1000) NH
         ARG=SQRPI/(ISTAP*SCALE)
         DO 40 I=1,NREFL
         BB=SJJ(I)*ARG
         DO 30 J=1,3
   30    IN(J)=HKL(J,I)*NH(J)
         X=0
         IF(FNUC(I)+FMAG(I).GT.0) X=FOBS(I)/(FNUC(I)+FMAG(I))
         X1=FNUC(I)/BB
         X2=X1*X
         X3=FMAG(I)/BB
         X4=X3*X
         X5=0
         IF(FOBS(I).NE.0) X5=FESD(I)/FOBS(I)
   40    WRITE(18,1002) IN,X1,X2,X3,X4,X5
         CLOSE(UNIT=18,STATUS='KEEP')
      END IF
      WRITE(6,1003)
      RETURN
 1000 FORMAT(5I8,F8.3,2F8.0)
 1001 FORMAT(/)
 1002 FORMAT(3I8,4F8.2,F8.4)
 1003 FORMAT(//,1X,129('+'))
      END
