TCB() Function - BBj

For this topic's original documentation, see the TCB() Function - Task Control Block.

BBj-Specific Information



In BBj 17.0 and higher, the optional int2 parameter specifies a program call level in the range 0 through TCB(13). When used with int1 values 2, 3, 4, 5, 6, 7, 8, 13, 23, and 24, this returns information about the specified program level.


Return Value


In BBj 9.0 and higher, TCB(2) returns 1 if the program is protected or 0 if it is not. PRO/5 throws an error for TCB(2).


TCB(3) returns 0 if the program has line numbers or 1 if line numbers are not used. PRO/5 always returns 0 for TCB(3).


If the program does not use line numbers, TCB(4) through TCB(8) return the ordinal line number within the source program.


In BBj 3.01 and higher, TCB(9) returns the number of significant digits for switching over from standard notation to scientific notation. The default is 16 digits.


May return a Java error instead an OS error.

In BBj 6.0 and higher, immediately after throwing !ERROR=0 attempting to read a file, TCB(10) returns the byte offset that was locked in the file. This value, when combined with the BBjOpenFileInfo::getExtracted() method, can be used to identify the holder of the lock and/or to force-close the file that holds the lock, if deemed appropriate.


[Last CPL() depth] is not supported in BBj.


One or more flags indicating how an ESCAPE was generated.


User pressed the escape key sequence (typically Ctrl+C) while a terminal window had focus.


User clicked the close box or pressed Alt+F4 on a terminal window.


User pressed CTRL+BREAK (Cmd+Period in macOS) while a GUI window had focus.


Thin client connection was lost.

These values are additive.

The SETESC verb resets TCB(19) to 0.


In BBj 14.00 and higher, TCB(21) returns the last SQL channel reporting an error.


In BBj 14.00 and higher, TCB(22) returns the last SQL channel used.

23 In BBj 20.20 and higher, TCB(23) returns the line number of the current DATA statement.
24 In BBj 20.20 and higher, TCB(24) returns the index number of the current expression within the current DATA statement.

See Also

Functions - Alphabetical Listing

PGM() Function - BBj