amsg { var %x = 1 while (%x <= $chan(0)) { if ($chan(%x) = #idle) { inc %x } else { msg $chan(%x) inc %x } } }