Functions and Directives

Function ProcLine() Foundation

Determines current line number in the source code.

ProcLine( [<nCallStack>], [<nThreadId>] ) --> nSourceCodeLine
<nCallStack> is a positive integer which indicates the position within the call stack of the function or procedure whose current line number is returned. The default value is zero which designates the current function or procedure.
<nThreadId> is a positive numeric identifying the thread whose current line number is returned. The default value is the return value of ThreadId().

The return value of ProcLine() is the line number in the source code file (PRG file) which contains the executing function or procedure. If the Xbase++ application was compiled with the compile switch /L, no line numbers are inserted into the OBJ file and ProcLine() always returns zero.


The debug function ProcLine() provides the program line in the source code file of the current line of code. When a code block is executed, ProcLine() provides the line in the PRG file where the code block was defined.

The function ProcLine() is used along with the function ProcName() to determine the location of an error.

// In the example, the return values of ProcLine() are 
// demonstrated. Comments include the line numbers 
// of the source code for easy comparison. 

PROCEDURE Main                // :001 
   LOCAL  nLine := ProcLine() // :002 
                              // :003 
   ? nLine                    // :004  -> result: 2 
   UserFunc()                 // :005 
                              // :006 
RETURN                        // :007 
                              // :008 
FUNCTION UserFunc()           // :009 
                              // :010 
   ? ProcLine()               // :011  -> result: 11 
   ? ProcLine(1)              // :012  -> result:  5 
   ? ProcLine(2)              // :013  -> result:  0 
                              // :014 
RETURN NIL                    // :015 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.