Returns the line number of a line being executed in a program relative to the first line of the main program.
- Returns the line number relative to the first line of the current program or procedure. If you omit the 1 argument, the line number is returned relative to the first line of the main program.
Program lines are counted starting from the top of the program. Comment lines, continuation lines, and blank lines are included in the line number count. If a program is suspended during execution, LINENO(В ) returns the number of the program line at which program execution was suspended. LINENO(В ) returns 0 if a program is canceled.
By default, line numbers are returned relative to the beginning of the main program. If a procedure is called, line numbering continues from the top of the calling program.
LINENO(В ) is useful for debugging programs. You can set a breakpoint to stop program execution at a specific line number by opening the Breakpoints window, setting the Type to 'Break when expression is true' and adding
LINENO(В ) = nExpression in the Expression textbox.
The following example is part of a simple error-handling routine.
ON ERROR DO bug_proc WITH LINENO( ) BRWS && Causes an error ON ERROR *** Bug_Proc error handler *** PROCEDURE bug_proc PARAMETERS gnBadLine WAIT WINDOW 'Error occurred at line: ' + ALLTRIM(STR(gnBadLine)) RETURN