You can use the consoleLib.currentArrayScreenLine() system function to determine the number of the current line within the scrolling screen array during an openUI statement.
consoleLib.currentArrayScreenLine( )
returns (result INT)
i = currentArrayDataLine();
j = currentArrayScreenLine();
The value of i is 19, indicating the 19th record in the data array. The value of j is 4, indicating the bottom row of the screen display. This is not the absolute line number within the window, but the relative line number within the scrolling screen array.