%LINE

Return the current line number

WSupported on Windows
USupported on Unix
VSupported on OpenVMS

 

line_num = %LINE

Return value

line_num

%LINE returns the line number of the current statement. (i)

Discussion

%LINE is useful if you’re using internal trace features to indicate which statement is being executed. Such tracing techniques are often helpful during the initial debugging of a complicated program.

Use MODNAME in .NET, but note the specified limitations.

Examples

The following debugging routine clears the bottom line of the screen and displays the line number and routine name of the program’s current execution position.

subroutine show_line 
record
    name        ,a10
    line_n      ,d4
proc 
    xcall modname(0, name) 
    line_n = %line
    display(TTCHN, $scr_pos(24,1), $scr_clr(line), 
 &          "At line ", ^a(line_n), "in routine ", name) 
    forms(TTCHN, 1)
    xreturn 
endsubroutine