The NUMBER item was in the original release of the PO in '76 as RECNO.  The
current doc states:

"NUMBER Data originate in spec. The record number is incremented at the end
of
each cycle."

This correctly describes the original implementation where there was just
the one source field (as all got the same number), but that was changed when
the number went to larger precision than 10 digits.

What really happens at least as of 1992 is that the number is inserted into
the record and the counter in the item is then incremented (as there can be
multiple and different NUMBER items).  Different NUMBER items use separate
counters, so the fiction was not originally detectable.

However, the 407 support added the possibility of conditional (and lately
multiple) issuing of a particular item.  Thus, if a NUMBER item is
suppressed by if/then or break, the increment does not occur and you get a
different number that is returned by the number() built-in function.  In
particular, NUMBER in an EOF item is one irrespective of the file size.  If
you iterate a NUMBER item with while/do, you will see an increment for each
iteration.

Whether this is useful or not is in the eye of the beholder, but there is no
way I can "fix" it given its age.

The number() built-in function recently introduced reflects correctly the
cycle count.  It is not updated for the run-out cycle; thus, number() in EOF
returns the input file size.  There is no built-in that returns the actual
number of output records generated.

I shall update the doc accordingly.  Anything else I need to add?

   j.

Reply via email to