pro rd_sxa, sttim, entim, index, data, infil=infil, old=old, qstop=qstop
;
;+
;NAME: 
;	rd_sxa
;PURPOSE:
;	Read the contents of the SXA 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 11-Oct-93 by M.Morrison
;	15-Nov-93 (MDM) - Added check that the requested file exists.
;-
;
qdebug = 1
exten = 'a.01'
;
if (not keyword_set(infil)) then begin
    weeks = week_loop(sttim, entim)
    files = 'sxa' + string(weeks.year, format='(i2.2)') + '_' + string(weeks.week, format='(i2.2)') + exten
    files = concat_dir('$DIR_SXT_SXA', files)
    ss = where(file_exist(files), count)
    if (count eq 0) then begin
	print, 'RD_SXA: 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
;
rd_xda, files, dsets, index, data
;
if (keyword_set(qstop)) then stop
end
