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 'DK1TCALL' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            DEFINITION-BLOCK.

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 code 03 occurs when a table with the same name is open in the TSR.

Other possible Error codes 12, 14, 15, 16, 17, 21, 41, 43, 44, 51, 55, 56, and 64 are related to invalid sub-parameters.

See tableBASE error codes.

Notes

If a Release Table Command (RL) is applied to a newly created table using a DT command, this would result in a return code of 0. The new table cannot be promoted from read to write. However, 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.

Define Table (DT)

9. LOCK-LATCH (8 bytes)

DEFINITION-BLOCK (256 bytes)