Define Table (DT)

Command title

Define Table

Description

DT builds a table in the TSR from the values supplied in the DEFINITION-BLOCK parameter.

COBOL syntax

MOVE 'DT'                   TO xxxx-COMMAND.
CALL 'TBLBASE' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            DEFINITION-BLOCK.

C syntax

memcpy( tbCommArea.tbCommand, "DT", 2 );
TBLBASE( &tbParm, &tbCommArea, &tbTableDefinition );

Parameters

DEFINITION-BLOCK

Explanation

Following successful execution of this command, the table is open for write.

The table to be defined may be given any valid table name that does not duplicate a table already open in the TSR (see Table names).

In a multi-user environment, if you want to control the user(s) or transactions that perform updates after the DT command (which causes the newly defined table to be open for write), place a password in the LOCK-LATCH field when using the DT command. Only the update commands that have the same password in the LOCK-LATCH field are authorized to perform the update (see 9. LOCK-LATCH (8 bytes)).

Should the table eventually be stored, it will be stored to the first library in the ML list at the time of the DT command. Thus, it may be necessary to do an ML command to set the LIB-LIST appropriately before doing the DT command. If the LIB-LIST is empty at the time of the DT, a suitable library for storing the table can be specified by a DV or DW command before any subsequent ST. If an ML command was never issued, this library is assumed to be the default library (the installation default library is MAINLIB).

Return value

Error 0003 occurs when a table with the same name is open in the TSR.

Other possible ERRORs 0012, 0014, 0015, 0016, 0017, 0021, 0041, 0043, 0044, 0051, 0055, 0056, and 0064 are related to invalid sub-parameters.

See tableBASE error codes.

Notes

In previous releases, if an RL command were applied to a newly created table using a Define Table command (DT), this would result in a return code of 38. Starting with Version 6, this returns a zero. Subsequent updates to the in-memory table, which is now open for read, will only work in a single user batch environment where exclusive access is assured. Open for read tables cannot be stored to a library. See Release Table (RL).

Exceptions

None

See also

Divert (Existing) Table (DW)—a DW command is needed before the store if the library contains a table with the same name.