Bug #3217

LINE-COUNTER function returns incorrect values

Added by Ovidiu Maxiniuc over 7 years ago. Updated over 7 years ago.

Start date:
Due date:
% Done:




#1 Updated by Ovidiu Maxiniuc over 7 years ago

The LINE-COUNTER function is documented to return values greater than the size of a page.
For streams, P4GL defers displaying frames until another one is displayed. This means if a frame is displayed multiple times, all of them will be 'flushed' in a single 'batch'. Because of this optimisation, if the last displayed frame fills the current page, the value returned by LINE-COUNTER can be larger than the number of lines the stream was configured with.

I found some client code in investigations for a missing TOP-PAGE frame that uses this (recommended idiom by P4GL reference book, in fact) to insert manually some text in the stream on the first line:

IF LINE-COUNTER(str) > PAGE-SIZE(str) THEN RUN add-page-header.

Because the current implementation effectively count the line from the output and reset the counter at the bottom of the page automatically, the LINE-COUNTER is never greater than the page size, so the page header is never printed.

#3 Updated by Greg Shah over 7 years ago

  • Project changed from Liberty to Base Language

#4 Updated by Ovidiu Maxiniuc over 7 years ago

  • % Done changed from 0 to 90
  • Start date deleted (12/06/2016)
  • Status changed from New to WIP

The cause of incorrect values returned by LINE-COUNTER was an incorrect computation of whether the page is filled or not. This was working fine for DISPLAY STREAM and it was only visible for PUT statements. The fix for this is part of the 3201c/11134.

#5 Updated by Ovidiu Maxiniuc over 7 years ago

The task branch (3201c) containing the changes for this issue was merged to trunk as rev 11135. This task can be closed.

#6 Updated by Greg Shah over 7 years ago

  • Assignee set to Ovidiu Maxiniuc
  • Target version set to Cleanup and Stablization for Server Features
  • Status changed from WIP to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF