C        A PROGRAM TO READ FREE-FORMAT CARD IMAGES OF H,K,L,FO,SIGFO    0001.000
C        AND WRITE THE GX SYSTEM REFLECTION FILE.                       0002.000
C        NSET IS THE BATCH NUMBER FOR BATCH SCALING, TBAR IS THE DEFAULT0003.000
C        PATH LENGTH IN CENTIMETRES.                                    0004.000
         INTEGER H(3)                                                   0005.000
         NREFL=0                                                        0006.000
         NSET=1                                                         0007.000
         TBAR=0.01                                                      0008.000
         OPEN (UNIT=5,FILE='P6122.RE')
         OPEN (UNIT=10,FILE='P6122.FO',FORM='UNFORMATTED')
 1       READ (5,*,END=2) H,FO,SIGFO                                    0009.000
         SIGFSQ=2.*FO*SIGFO                                             0010.000
         FSQ=FO*FO                                                      0011.000
         NREFL=NREFL+1                                                  0012.000
         IW1=NSET*16777216+(H(1)+128)*65536+(H(2)+128)*256+H(3)+128     0013.000
         IW2=IFIX(TBAR*1.E4)*65536+NREFL                                0014.000
         WRITE (10) IW1,IW2,FSQ,SIGFSQ                                  0015.000
         GO TO 1                                                        0016.000
 2       ENDFILE 10                                                     0017.000
         STOP                                                           0018.000
         END                                                            0019.000
