pro rd_hda_data, lun, ibyt, idset, nout, index, data, roadmap, sel_dsets
;+
;NAME:
;	RD_HDA_DATA
;PURPOSE:
;	Perform the actual data read for HDA files (called from RD_XDA)
;INPUT:
;	lun	- the logical unit number where the file is open
;	ibyt	- the starting byte value to read from
;	idset	- the dataset number for the output matrix
;	nout	- the total number of datasets to be extracted
;	index	- the index structure for all output datasets
;	roadmap	- the roadmap
;	sel_dsets- the indicies of the datasets selected for extraction
;INPUT/OUTPUT:
;	data	- the data
;HISTORY:
;	written 21-Mar-92 by Mons Morrison
;-
;
common rd_hda_data_blk, data0
;
if (idset eq 0) then begin
    ss = where(roadmap(sel_dsets).datarectypes ne 0)        ;where there is data
    if (ss(0) ne -1) then data = bytarr(4,64,4, nout)       ;avoid padding data unnessarily
    data0 = bytarr(4,64,4)
end
;
if (index(idset).gen.ndatabyte eq 0) then return
if (index(idset).hxt.dataRecTypes eq 0) then return	;there is no data saved (probably Quiet mode)

rdwrt, 'R', lun, ibyt, 0, data0, 1
;
data(0,0,0,idset) = data0
;
end
