on error return
define character header*16
if ("&1none".eq."none") then
   let header 'drawn'
else
   let header &1
endif
if ('header'major.eq.0) then
  say "No clean beam, flux density estimate impossible"
  return
endif
if ("&2none".ne."none") then
   greg2\polygon &2 /plot
else
   greg2\polygon
endif
define real flux
greg2\mean
let flux poly%sum|pi|'header'major|'header'minor*4*log(2)
if (flux.lt.0.03) then
  if (flux.gt.0.001) then
    say "Total Flux "'0.1*nint(flux*10000.)'" mJy"
  else
    say "Total Flux "'nint(flux*1E6)'" microJy"
  endif
else if (flux.lt.1.0) then
  say "Total Flux "'nint(flux*1000.)'" mJy"
else
  say "Total Flux "'0.01*nint(flux*100.)'" Jy"
endif
!
