%N tabflux %F $MIR/src/subs/tabflux.for
%D Return the flux of a calibrator source at an input freq.
%P pjt
%: calibration, flux, frequency
%B
      subroutine tabflux(filename, source, freq, delfreq, day, delday,
     *  flux, rms, Line, iostat)

      implicit none
      character filename*(*), source*(*)
      integer Line, iostat
      real freq, delfreq, delday, flux, rms
      double precision day

 Input:
   filename The name of the flux calibrator file.  If this is a
            blank string, then it defaults first to the file
            pointed to by the environment variable $MIRFLUXTAB;
            second to the file ./FluxSource.cat; and, finally, to
            $MIRCAT/FluxSource.cat.
            The old style cals.fluxes format is still recognized,
            but deprecated as of Miriad 4.1.0
   delfreq  The frequency width (real: GHz) around the parameter
            ``freq'' in which to include a frequency match.
   delday   The date width (real: Julian days) around the parameter
            ``day'' in which to include a date match.

 Input/Output:
   source   The calibrator source name ('*' means all sources;
            minimum match of name is in effect).
            Output is the full name of the source that matches.
   freq     The frequency (GHz) of the calibrator data desired (input
            value of 0.0 defaults match to all frequencies).  Output
            is the freq (GHz) of the match.
   day      The day flag for the routine 'tabfind.' Day = 0 means the
            most recent match; day means first match since day; and -day
            means first match less than abs(day).  The internal format
            for day (when day != 0) is the same as for DATE entries in
            the flux calibration file (Julian Day).  On Output, day
            is the Julian Day of the match(s).
   flux     On Input, flux is the lower limit flux (Jy) of the calibrator
            in which to consider a match and defaults to all matching
            fluxes if set to 0.0.  On Output, flux (Jy) is the matching
            source(s) flux value at freq GHz.
   Line     On Input, this integer represents the next entry in the
            sorted flux table (not the file) to consider for a match.
            Line = 1 is the first table entry, so to effectively "rewind"
            the sorted table, reset Line to 1 on each subsequent call.
            On output, Line is next item to consider as a possible match.

 Output:
   rms      The rms (Jy) of the calibrator (set to 0 if not listed).
   iostat   The returned error code.  0 means no error; -1 means no
            data read; -2, EOF.  Other errors from routine TABFIND.
