TCL and General User Commands

This topic introduces the Terminal Command Language, describing:

It contains a list of general user commands that are not described elsewhere in the Reality documentation and provides a detailed description of each. Included are TCL commands for:

Introduction to the Terminal Control Language

The Terminal Control Language (TCL) is the primary interface between database users and Reality processors. Processors are executed by typing a command input statement at the TCL colon prompt (:) and pressing the return key.

Note: If you are running the evaluation version of Reality, the TCL colon prompt will be prefixed by the text “Eval”.

The following types of TCL command are supported by Reality:

Command Definition Items

TCL commands available for use in an account are defined by command definition items in the account's Master Dictionary (MD). The item-id of a command definition item is the name of the command it defines. The first attribute of the definition item specifies the type of command. Proc definition items contain PQ or PQN in attribute 1. All other command definition items have P or V as the first character in attribute 1. Some have a second character that defines special functions that have to be performed by Reality software for that particular command.

Synonym Command Definition Items

A synonym command definition item is identified by a V in attribute 1. A synonym definition item can be created by the user to reference a standard command definition item, providing an alternative name that can be entered at TCL to execute the command. The synonym item-id chosen must be unique within the MD. With V in the first attribute, the second attribute contains the item-id of the referenced command.

Further Information

The topic Command Definition Items details all types of command definition items.

TCL Input Processing

The command input statement entered at the TCL colon prompt must begin with a command name which matches the item-id of one of the command types listed previously. Each input statement can include several lines of parameters, but only one command name. The statement is processed by TCL after return is pressed. When processing is complete, Reality re-displays the TCL colon prompt.

The TCL processor analyses an input statement as follows:

  1. It looks up the first word of the input statement in first the command definition item-ids in the MD and then the commands in the alternate verbs file. If the word is not found, it displays the following error message:

    command IS NOT A VERB
  2. If the word is found, the processor formats the command string to remove redundant blanks, and recognise and interpret quoted strings and options. The command string is then passed to the processor appropriate to the type of command, as defined in attribute 1 of the command definition item.

Case-sensitivity at TCL

In general, the TCL processor is sensitive to the case of commands you enter. However, if the command cannot be found and the first character is in lower case, the entire command line except for any quoted strings is converted to upper case and the search is repeated. For example, if you enter

edelete test "$testitem"

this will be converted to

EDELETE TEST "$testitem"

Notes:

Line Continuation

When you are typing characters in response to the TCL prompt, the system allows you to enter up to 240 characters before it performs an automatic linefeed. However, you can extend a line by pressing a line continuation key combination.

To specify line continuation, hold down the ctrl key and press the underscore key (_); this may require you to hold down the shift key as well as CTRL. Then press the return key.

Note: If a space is required at the line continuation, this must be included as if the line continuation had not been entered.

TCL-I Commands

TCL-I commands execute directly and do not require a fixed format of parameters to be entered after the command, unlike the TCL-II commands described next. The only rule for a TCL-I input statement is that it must begin with a TCL-I command and end with return. Some TCL-I commands do accept parameters or have options; others have no parameters or options. The TCL-I syntax is as follows:

command {parameter}... {(options}

where:

command specifies the operation.

parameter is required for some TCL-I commands.

Most TCL-I commands either allow no options or allow only the following:

H Heading. Suppresses default heading line.

N No Page. Inhibits automatic pause at end of screen.

P Print. Sends output to the Spooler.

Examples of TCL-I commands are ADDX, BLOCK-PRINT and LISTVERBS.

TCL-II Commands

TCL-II commands execute the TCL-II processor first before transferring control to the specific execution code. These commands require certain parameters always to be supplied. These must comprise a file specifier followed by one or more item-ids, then optionally, one or more options. The syntax must be as follows:

command file-specifier item-list {(options}

where:

command Specifies the operation.

file-specifier Specifies the file to be processed. For details, see General Conventions.

item-list One or more item-ids separated by spaces. If an item-id contains embedded blanks or parentheses, it must be surrounded by single or double quotes.

To specify all the items in a file, enter an asterisk (*) for the item-list.

You can also use an active select list instead of an item list. This is supplied by a command that generates a select list executed immediately before the TCL-II command. For more information, refer to the topic Item-List-Generating Commands.

If you do not provide any type of item list, the processor prompts you for one.

Unless otherwise noted, TCL-II commands support the following options.

N No Page. Inhibits automatic pause at end of screen.

P Print. Sends output to the Spooler.

Several options can be specified at the same time. For example, (IP.

Examples of TCL-II commands are COPY, COMP and PRINT-ERR.

English Commands

English commands are entered at TCL, but control is passed to the English processor for the command to be executed. An English input statement consists of a command and a file specifier followed by a number of optional clauses. Generally, the clauses can be entered in any sequence. For detailed information on constructing an English input statement, refer to the The English Sentence.

Item-List-Generating Commands

TCL and English commands can be used in conjunction with list-generating commands. These commands generate a select list that can be used to supply an item list to an immediately following TCL-II or English command. Alternatively, the list can be saved via SAVE-LIST or NEW-SAVE-LIST for later retrieval via the GET-LIST or NEW-GET-LIST command respectively.

The active Select list is indicated by a change from the usual TCL prompt, the colon (:), to the select prompt, the 'greater than' (>) symbol. The next command you enter at this new prompt uses the active list.

For example, to copy all of the items in the file BP that begin with the letter B to another file called NEWBP, type the following:

:SELECT BP = 'B]'
26 ITEMS SELECTED.
>COPY BP
TO:(NEWBP
26 ITEMS COPIED

Item List Processing Commands

Other commands that enable lists to be managed are listed in List Processing Commands.

Cataloged DataBasic Programs

Commands that are cataloged DataBasic programs are executed by entering the name of the program at the TCL prompt (:). The syntax will depend on the program.

A compiled program is cataloged using the CATALOG command; this loads the program object item into a system file called POINTER-FILE and creates a command definition item in the MD of the account in which the program is cataloged. The command definition item points to the object item. For more information, refer to Introduction to DataBasic.

Procs

These commands are executed by typing the name of the Proc at the TCL prompt (:). The syntax will depend on the Proc. Some system commands are Procs.

Proc commands have the code PQ or PQN in attribute one of their Proc definition items. You can create new commands by writing your own Procs.

Creating New Proc Commands

When creating new Proc commands two conventions should be observed.

For more information, refer to the Proc Reference.

Go to top button