c     This program collapses the REAC (ASCII) transmutation cross section 
c        file and/or converts the format into either FISPACT or RACC.
c
c     *****************************************************************
c
c     Input (on standard input):
c     Record #1 - control parameters
c        ngfine  (i)  number of groups in inital group structure.
c                     nonpositive value => 175
c        ngcoar  (i)  number of groups in final structure.
c                     Must be positive and less than ngfine
c                     If default used for ngfine, then can use default 
c                        for ngcoar 
c        outfor  (a)  output format for cross sections.  Choices are
c                        'FISPACT'
c                        'RACC'
c                        'REAC'
c                     'x' where x is zero or more blanks => 'REAC'
c        filein  (a)  filename (including path) for cross sections
c                       in initial group structure.
c                     filename should  be enclosed in quotes (').
c                     'x' where x is zero or more blanks => 'cross0'
c        fileot  (a)  filename (including path) for cross sections
c                       in final group structure. 
c                     filename should  be enclosed in quotes (').
c                     'x' where x is zero or more blanks => 'cross1'
c
c     Record #2 - collapsing parameters (consists of ngfine cards)
c        nf      (i5) number of initial group.  card 1 has nf = 1,
c                     card 2 has 2, etc.
c        nfng    (i)  final group number corresponding to given 
c                       initial group.
c                     nfng(*) must be nondecreasing.  differences
c                       between successive entries can be 0 or 1. 
c                     0's in lowest energy groups imply that final
c                       group structure does not extend into the lower
c                       range of the initial group.
c                     values greater than ngfine indicate that final
c                       group structure does not extend into the higher
c                       range of the initial group.
c        wgt     (r)  weighting for each fine group for the 
c                       corresponding coarse group
c                     0 => that value taken from vitamin-j weighting
c                       for 175 groups.  If ngfine <> 175, then error.
c
c     *****************************************************************
c
      character*8  outfor
      integer      ngfine, ngcoar
      logical      eof
c
c     read record 1
      call  read1 (ngfine,ngcoar,outfor)
c
c     get weighting factors
      call getwgt (ngfine,ngcoar)
c
c     read header information
      call rhead (ngfine)
c
c     loop over cross sections
10    continue
c
c        read cross sections
         call readxs (ngfine,eof)
         if (eof) go to 20
c
c        collapse cross sections
         call colxs (ngfine,ngcoar) 
c
c        write cross sections to temporary file
         call wxs(ngfine,ngcoar,outfor)
c
c     end loop over cross sections
      go to 10
c
c     write header information
20    call whead (ngcoar,outfor)
c
c     copy cross sections from temporary to output file
      call copyxs (outfor)
c
      end
