Skip to content

TCB

Task Control Block

This numeric function returns the status of certain program execution values that change during processing of a task. These values relate to error and escape processing and are continuously updated by the appropriate directives and system processes.

TCB (numeric-value [,ERR=line-ref|,ERC=error-code])
numeric-value
is any integer in the range of 0 to 9 or 13.
line-ref
is the program line number or label to branch to if an error is produced by this function.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

This function returns the following values:

TCB ()
returns 0
TCB (1)
returns the number of available entries for Public Programs
TCB (2)
returns the channel of the last error except channel 0
TCB (3)
returns the last operating system error code
TCB (4)
returns the current statement number
TCB (5)
returns the number of the statement that last caused an error
TCB (6)
returns the statement that SETESC is set to
TCB (7)
returns the statement that SETERR is set to
TCB (8)
returns the shell exit code from the last SYSTEM directive
TCB (9)
returns the shell termination status
TCB
(13) returns the current public program level. The value is the actual number of public programs in the stack. While in the main program, this value is 0.
TCB(29)
returns the journaling trace mode value. This value is used for the debugging of journaling problems.
TCB(30)
returns the variable name entry mode:

0 LONGVAR is enabled ( the default )

1 SHORTVAR is enabled

TCB(40)
returns the sort number that generated the error 107
TCB(41)
returns the sort field that generated the error 107.
TCB(42)
returns a value that represents the reason for the error 107:

-1 No sorts defined or the specified sort is not defined

-2 Invalid sort field

-3 Error during the numeric conversion of the sort field. See TCB(43) for the basic error code

-4 Error during I/O. See TCB(43) for the basic error code

TCB(43)
returns the basic error code that generated the error 107. See TCB(42).
LET X = TCB (6)

If X is assigned the value 5678, the statement that the SETESC directive is set to is 05678.

LET ERROR_LINE = TCB(5), ERROR_CODE = ERR

provides information to the programmer about what error most recently occurred and at what line in the program.

TSM system variable

From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF