PAGE('SYNC_READYTOPROCESSCOUNT')

This command returns the number of tasks that are ready to be processed.

int PAGE('SYNC_READYTOPROCESSCOUNT');

example:
if PAGE('SYNC_READYTOPROCESSCOUNT') > 0 THEN
  ...
end;