Divert (Existing) Table (DW)

Command title

Divert Table to a library that already contains a table with the same name


This command causes any subsequent store of the table to be targeted to the tableBASE library specified in the DDNAME parameter. Unlike DV, DW is used when the targeted library already contains a table with the same name, in which case an ST command causes the specified table in a TSR to be stored as a new generation of a table in the target tableBASE library.

COBOL syntax

MOVE 'DW'                   TO xxxx-COMMAND.

C syntax

memcpy( tbCommArea.tbCommand, "DW", 2 );
TBLBASE( &tbParm, &tbCommArea, pDDName );




If the table on the target library has a write password, then the table being Diverted must have the same write password. If the table on the target library does not have a write password, and the table being Diverted does have a write password, then this write password will be removed.

DW allows a new table (either newly created or new by virtue of a Change Name command) to be stored into a tableBASE library which already has a table by that name.

DW also allows a table to be opened from one library, and stored to another library.

Return value

Error 0040 subcode 1 occurs if the DDNAME does not exist.

Error 0031 occurs if the table being diverted does not contain the identical write password as the target table.

Error 0009 subcode 3 occurs if table does not exist on the target library.


This command does not actually store the table; the store must be explicitly performed by issuing an ST command. If the table was opened with an OR in batch using a local TSR, the DW command promotes the table to Open for write and allows the table to be updated and stored. In an online interface, batch multitasking or multitasking environment such as a VTS-TSR, the table must be open for write.



See also

Divert (Non-existing) Table (DV)

Store Table (ST)