Task

Produce a sequential count in octal,   starting at zero,   and using an increment of a one for each consecutive number.

Each number should appear on a single line,   and the program should count until terminated,   or until the maximum value of the numeric type in use is reached.



Related task

   Integer sequence   is a similar task without the use of octal numbers.


/* Do the actual counting in octal. */
count: procedure options (main);
   declare v(5) fixed(1) static initial ((5)0);
   declare (i, k) fixed;
 
   do k = 1 to 999;
      call inc;
      put skip edit ( (v(i) do i = 1 to 5) ) (f(1));
   end;
 
inc: proc;
   declare (carry, i) fixed binary;
 
   carry = 1;
   do i = 5 to 1 by -1;
      v(i) = v(i) + carry;
      if v(i) > 7 then
         do; v(i) = v(i) - 8; if i = 1 then stop; carry = 1; end;
      else
         carry = 0;
   end;
end inc;
 
end count;