pro rd_sxc, sttim, entim, index, data, infil=infil
;
;+
;NAME: 
;	rd_sxc
;PURPOSE:
;	Read the contents of the SXC data files
;INPUT:
;	sttim	- start time in any format
;	entim	- end time in any format
;OPTIONAL KEYWORD INPUT:
;	infil	- The user can specify the input file name
;		  instead of the start/end times.  Must be a scalar.
;OUTPUT:
;	index	- an index structure
;	data	- an array structure
;HISTORY:
;	Written 26-May-93 by M.Morrison
;	14-Jul-93 (MDM) - Added call to OFR2FRE
;	20-Jan-93 (SLF) - use rd_sxl as template (rd via rd_xda)
;-
;
qdebug = 1
;
sxt_struct, sxt_xrcen=data_ref
;
exten = 'a.01'
if (keyword_set(old)) then exten = 'a.01'
;
if (not keyword_set(infil)) then begin
    weeks = week_loop(sttim, entim)
    files = 'sxc' + string(weeks.year, format='(i2.2)') + '_' + string(weeks.week, format='(i2.2)') + exten
    files = concat_dir('$DIR_SXT_SXC', files)
    ss = where(file_exist(files), count)
    if (count eq 0) then begin
	print, 'RD_SXC: Cannot find the necessary files:'
	prstr, '   ' + files
	return
    end
    files = files(ss)
    rd_roadmap, files, roadmap
    if (get_nbytes(roadmap) lt 10) then return
    dsets = sel_timrange(roadmap, sttim, entim, /between)
    qinfil = 0
end else begin
    files = infil
    dsets = -1
    qinfil = 1
end
;
if (keyword_set(summary)) then begin
    rd_roadmap, files, index
    ss = sel_timrange(index, sttim, entim, /bet)
    if (ss(0) ne -1) then index = index(ss)
endif else begin
    rd_xda, files, dsets, index, data
endelse
;
;
ofr2fre, 'SXC', index, data

if (keyword_set(qstop)) then stop
return

end
