;+
; Project     : SOHO - CDS     
;                   
; Name        : TM_PARAM()
;               
; Purpose     : Return details of parameters in the telemetry database.
;               
; Explanation : 
;               
; Use         : IDL> print,tm_param('BXGZOD')  would print the telemetry
;                                              details of the GIS ZOD.
;    
; Inputs      : param - parameter name (or part thereof)
;               
; Opt. Inputs : None
;               
; Outputs     : Function returns strarr(18,n) where n = number of parameters
;                                             with name including 'param'
;               
; Opt. Outputs: None
;               
; Keywords    : QUIET   - if present results are not printed.
;               COMMENT - if present string is matched to comments
;                         as opposed to the parameter name
;
; Calls       : GET_MASK_ETC
;
; Common      : None
;               
; Restrictions: None
;               
; Side effects: None
;               
; Category    : Telemetry
;               
; Prev. Hist. : None
;
; Written     : C D Pike, RAL.  18-Sept-95
;               
; Modified    : 
;
; Version     : Version 1, 18-Sep-95
;-            

function tm_param, name, quiet=quiet, comment=comment

;
;  if no name or string given, return all of 'em
;
if n_params() eq 0 then begin
   get_mask_etc,m
   return,m
endif

;
;  pickup all the current database
;
get_mask_etc, par

;
;  treat input parameter as a search string
;
p = strupcase(name)

;
;  find any occurrences
;
if keyword_set(comment) then nf = 17 else nf = 0
n = where(strpos(par(nf,*),p) ge 0)

;
;  if any, print and return
;
if not keyword_set(quiet) then begin
   if n(0) ge 0 then begin
      for i=0,n_elements(n)-1 do begin
         print,par(*,n(i)),form='(18(a,2x))'
      endfor
   endif
endif

if n(0) ge 0 then begin
   return,par(*,n)
endif else begin
   print,'Nothing found.'
endelse

end
