Change Table Definition (CD)

Command title

Change Table Definition


This command changes the internal definition of a table (or opened alternate index) in memory and, if necessary, reorganizes the table in memory to match the new definition.

COBOL syntax

MOVE 'CD'                   TO xxxx-COMMAND.

C syntax

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



The following fields from the definition block can be changed using the CD command:

  • ORG, METHOD, INDEX (although this field is only maintained for backward compatibility since V6), RPSWD, WPSWD, RSZ, KSZ, KLOC, EXP-FACT, LO-DEN, HI-DEN, VIEW-VERSION (used by tBOL/CICS only), VIEW-NAME (used by tBOL/CICS only), USER-COMMENTS.
Read and Write PASSWORDS and USER-COMMENTS cannot be cleared by using blank sub-parameters because blanks are interpreted to mean no change. Instead, an asterisk (*) must be entered as the first byte of the PASSWORD or USER-COMMENTS field to remove it.



Return value

Error Code 14 – The row size must be from 1 to 32767.

Error Code 15 – The key size must be from 1 to 256.

Error Code 17 – The changes in key specifications will not fit within the row area.

Error Code 28 – Cannot use CD command to change SMC to P.

Error Code 56 – The search method specified is incompatible with the organization of the table.

Error Code 73—Applying the CD command to a table opened for Read is successful if MULTITASKING=N, but returns Error Code 73 if MULTITASKING=Y.

Error Code 92—In the event of receiving an Error Code 92 create more space in the VTS-TSR or local TSR (not unique to CD).

Others may apply.


If the new row size is smaller than the old one, all rows in the table are truncated on the right. If the new row size is greater than the old one, then all rows in the table are padded on the right with low values.

If the table is subsequently stored, it will be stored with the new definition.

Changes to sub-parameters Organization, Key Size and Key Location cause an index to be re-organized to match the new definition. These are the only changes which can cause the index to be re-organized.

SMC cannot be changed using the CD command. Attempting to do so may result in an error code; the value will not be changed (even if the error code returned is 0). This applies to both base and alternate tables.

The number of GENERATIONS to be kept sub-parameter can be changed using the CG command.



See also