;+
; NAME:
;	PR_GRPPLN
; PURPOSE:
;	Splits BCS grouper plan into its components and prints it
; CATEGORY:
; CALLING SEQUENCE:
;	pr_grppln,plans,jp
; INPUTS:
;	plans		grouper plans structure
;	jp		plan to print
; OPTIONAL INPUT PARAMETERS:
; KEYWORD PARAMETERS:
; OUTPUTS:
; OPTIONAL OUTPUT PARAMETERS:
; COMMON BLOCKS:
; SIDE EFFECTS:
; RESTRICTIONS:
; PROCEDURE:
; MODIFICATION HISTORY:
;	RDB   5-May-94	Written
;	RDB  17-May-94	Changed .grpid to .planid for reformatter compatability
;-

pro	pr_grppln,plans,jp

ttl=0
;;for jp = ifrom,ito do begin
  if (plans(jp).planid ge 0) then begin		;ID=-1 is unfilled slot
	print,'Grouper ID:',plans(jp).planid,'length:',plans(jp).length,format='(a,i3,6x,a,i4)'
;	print,plans(jp).planid,plans(jp).ngrp
	yy = 0
	for jg = 0,3 do begin
		ngrp = plans(jp).ngrp(jg)
		if ngrp eq 0 then ngrp = 2
		print,plans(jp).grps(0:ngrp*2-1,jg)
		yy = [yy,plans(jp).grps(0:ngrp*2-1,jg)]
		endfor
;	print,'Total number of bins=',plans(jp).length
	yy = yy(1:*)		;get rid of initial 0
	print,yy,format='(16(x,Z2.2))'
	nyy = n_elements(yy)

  if ttl gt 0 then begin
    sformat = '(2x,i4,4x,Z2.2,i8,4x,4i1,2x,' + string(nyy,'(i2)') + 'i4)'
    ;;print,'sformat= ',sformat
    printf, ttl, plans(jp).planid, plans(jp).planid, plans(jp).length, 	$
	plans(jp).ngrp, yy, format=sformat
  endif
endif
;;  endfor

end
