
pro rdspc2_head, file, numbsd, numthe, firchn, pointr, spcnam, $
                bpcnam, balcal, version 
;+
; IDL v. 2
;
; Purpose:
; 
; read the first seven records in the SPC file with the theory spectra
; File is openned for sequential reading, then closed. 
;
;input:
;	file = name of SPC file to be read 
;output:
;
; numbsd = total number of raw spectra in BSD file
; numthe = total number of theory spectra in each channel
; firchn = spectrum number of the first theory spectrum in each 
;          channel
; pointr = pointer to the roadmap (i.e. record number where the 
;          roadmap for each channel begins
; spcnam = name of the SPC file
; bpcnam =  name of BPC file used to run BSDFIT 
; version = text with version number etc.
; balcal =  ionization balance calculation used
; 
; Written:
;    AF, May-1991
;-

 get_lun,lun
 openr,lun,file     ;  open for sequential read 


 spcnam = bytarr(64)
 bsdnam = bytarr(64)
 bpcnam = bytarr(64)
 balcal = bytarr(64)
 version = bytarr(64)
 blank = bytarr(64)
 
 forrd,lun,spcnam
 forrd,lun,bsdnam
 forrd,lun,bpcnam
 forrd,lun,balcal
 forrd,lun,version
 
 spcnam = string(spcnam)
 bsdnam = string(bsdnam)
 bpcnam = string(bpcnam)
 balcal = string(balcal)
 version = string(version)


 vnum = long(0)     ; version number of SPC file format
 totspc = long(0)   ; total no. of theory spectra in SPC file
 totbsd = long(0)   ; total no. of spectra in the BSD file
 totpri = long(0)   ; total no. of primary component spectra
 numthe = lonarr(4) ; no. of theory spectra in each channel
 numbsd = lonarr(4) ; number of raw spectra in BSD file
 firchn = lonarr(4) ; SPCNUM of first theory spectrum in the file
 pointr = lonarr(4) ; pointer to the first record of the roadmap
 

;;     >  VNUM, TOTBSD, TOTSPC, TOTPRI, (NUMBSD(I),I=1,NCHANS), 
;;     >  (NUMTHE(I),I=1,NCHANS), (FIRCHN(I),I=1,NCHANS) 

 forrd, lun,  vnum, totbsd, totspc, totpri, numbsd, numthe, firchn
   
 forrd, lun, pointr
 	
 close,lun
 free_lun,lun


 end
