Programming Guide


Duplicates the data on the screen so it can be edited

int sm_tm_command ("COPY");


COPY copies the data on the screen for use in the next insertion.

After you select COPY, the following steps occur:

  1. If you have made changes in the table views on which this command operates in a previous NEW, COPY, COPY_FOR_UPDATE, or SELECT, you are prompted to discard your changes. If you choose OK, changes are discarded; however, the data remains visible and is treated as though you had just typed it in after a NEW command. If you choose Cancel, you return to the screen so you can save your changes.
  2. The data currently displayed on the screen is copied.
  3. The transaction mode is set to new. By default, this mode clears all the protection bits in updatable table views to reflect that data entry is available in those widgets.
  4. Edit the data as much as you wish. Select SAVE to insert the data into the database. If you select SAVE without changing any data, the transaction manager generates an INSERT statement for the duplicate data. Depending on the engine, this could result in a duplicate entry or in an engine error.

Push buttons and menu selections for the COPY command can choose to set the class property to copy_button. By default, copy_button is active in all transaction modes.


COPY is available after you enter new data using NEW and SAVE. It is also available after SELECT or VIEW which display data on the screen. Select SAVE after you finish your edits.


The following requests can be generated by the COPY command to ascertain whether the changes from the previous command have been saved and, if desired, to discard those changes:

Since no TM_DISCARD request is made for the COPY command, the discard flag used in TM_POST_SAVE1 is not set.

Table 8-15 Request events for COPY

Request Traversal Typical Processing


By table/server view from the specified table view

Do nothing


By table/server view from the specified table view

Do nothing (sm_bi_initialize is called for the table view by the transaction manager after this request)


By table/server view from the specified table view

Do nothing

See Also