define integer ncomp nplanes
if (&1%unit2.eq."COMPONENT") then
  let ncomp &1%dim[2]
  let nplanes &1%dim[3]
  SAY 'Nplanes'" planes with "'ncomp'" components"
  define real cct_flux[ncomp,nplanes] /global
  define real cvalue[ncomp,nplanes]
  define integer k
  !
  for iplane 1 to nplanes
    let cvalue[iplane] &1[3,,iplane]
    compute cct_flux[iplane] integral cvalue[iplane]
  next
else
  let ncomp &1%dim[3]
  let nplanes &1%dim[2]
  define real cct_flux[ncomp,nplanes] /global
  define real cvalue[ncomp,nplanes]
  define integer k
  !
  for iplane 1 to nplanes
    let cvalue[iplane] &1[3,iplane,]
    compute cct_flux[iplane] integral cvalue[iplane]
  next
endif
SAY "Done integrals"
if exist(cct_ncomp) delete /var cct_ncomp
define integer cct_ncomp[nplanes] /global
!
define real lcomp[ncomp] value
for iplane 1 to nplanes
  let lcomp[icomp] icomp
  let lcomp 0 /where cvalue[iplane].eq.0
  compute value max lcomp
  let cct_ncomp[iplane] value
next
!
