Change the table name and definition in memory

*
*     CHANGE THE DEFINITION AND NAME OF AN EXISTING TABLE
*
      MOVE 'OR'                   TO xxxx-COMMAND.
      MOVE 'TABLE1'               TO xxxx-TABLE.
      CALL 'TBLBASE' USING        TB-PARM
                                  xxxx-COMMAND-AREA.
      MOVE 'CN'                   TO xxxx-COMMAND.
      MOVE 'TABLE2'               TO NEW-TABLE-NAME.
      CALL 'TBLBASE' USING        TB-PARM
                                  xxxx-COMMAND-AREA
                                  NEW-TABLE-NAME.
      MOVE 'TABLE2'               TO xxxx-TABLE.
      MOVE NEW-KEYSIZE            TO xxxx-KSZ.
      MOVE NEW-KEYLOC             TO xxxx-KLOC.
      MOVE 'CD'                   TO xxxx-COMMAND.
      CALL 'TBLBASE' USING        TB-PARM
                                  xxxx-COMMAND-AREA
                                  xxxx-DEFINITION-BLOCK.
Note:
In single-thread batch, you may use the CN command on an open-read table, but in multi-user environments (e.g. CICS, multi-thread batch, VTS), the table must be opened for write.