# tcl statement

The tcl statement executes any valid TCL command as a
 subroutine.

## Syntax

```
tcl tcl.command{to dim.array.var)
```

## Parameter(s)

| tcl.command | TCL command to execute as a subroutine. |
| --- | --- |
| dim.array.var | Receives the last message number and arguments of the tcl.command . |

## Description

After execution, the FlashBASIC or BASIC program continues with the next statement.

 Input can be passed to the TCL statements using the data statement prior to
 the tcl statement.

 The to modifier passes the last message number and arguments of the
 tcl statement to the specified dimensioned array variable.

 After the tcl statement is completed, the data queue (stack) is reset.
 Multiple `data` statements can be passed when they are separated by value marks.
 Multiple tcl statements can be passed when they are separated by attribute
 marks.

 If an active list is generated by the tcl statement, it is passed back to
 the FlashBASIC or BASIC program. The list can be used by the readnext
 statement or it can be assigned to a specific variable using the
 select to statement for later use with a readnext
 statement.

 If the TCL off command is issued as the tcl statement,
 control does not return to the FlashBASIC or BASIC program.

 CAUTION:
 These commands can alter the program environment when returning to the next program
 statement:

- spooler commands

- tape control commands

- debug

- charges

- term

- tabs

 If the number of error message item-IDs exceeds the size of the array, the extra IDs are
 forced into the last array location and are delimited by attribute marks.

## Example(s)

This example executes an AQL count command and returns the error message
 item-IDs to the dimensioned array, results.

```
dim results(3)
tcl ’count md if a1 "pq"’ to results
```

 The output of the tcl statement displays as follows:

```
[407] 26 items counted out of 897 items
```

 The contents of the dimensioned array results displays as follows:

```
results(1) = 407
results(2) = 26
results(3) = 897
```

## See also

- [Active list](https://d3codex.com/definitions/active-list/)
- [call statement](https://d3codex.com/pickbasic-flashbasic/call-statement/)
- [capturing statement](https://d3codex.com/pickbasic-flashbasic/capturing-statement/)
- [$chain directive](https://d3codex.com/pickbasic-flashbasic/dollar-chain-directive/)
- [enter statement](https://d3codex.com/pickbasic-flashbasic/enter-statement/)
- [execute statement (UNIX)](https://d3codex.com/pickbasic-flashbasic/execute-statement-unix/)
- [clearselect statement](https://d3codex.com/pickbasic-flashbasic/clearselect-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)

---
Source: https://d3codex.com/pickbasic-flashbasic/tcl-statement/ - part of the D3Codex reference.
