Programming Guide


Copies current values of a range of occurrences to before images

#include <tmusubs.h>
int sm_bi_copy(void);



sm_bi_copy writes the current values of a range of occurrences to their respective before-image occurrences. The starting occurrence is the value of sm_tm_inquire("TM_OCC") and the range of occurrences is determined by the value of sm_tm_inquire("TM_OCC_COUNT"). If TM_OCC_COUNT has a value of -1, sm_bi_copy gets the number of occurrences in the table view. If TM_OCC has a value of 1 and TM_OCC_COUNT has -1, sm_bi_copy copies every occurrence in the table view. Use sm_tm_iset to set the values of TM_OCC and TM_OCC_COUNT before calling sm_bi_copy.

The SELECT transaction command calls sm_bi_copy for updatable and non-updatable table views. It sets TM_OCC to the first occurrence where data was fetched; it sets TM_OCC_COUNT to the number of rows fetched. Therefore, sm_bi_copy copies each selected occurrence.

The standard transaction models call sm_bi_copy in the TM_POST_SAVE request if the current mode is TM_UPDATE_MODE and sm_bi_initialize was successful. Notice that the models set TM_OCC_COUNT to -1 before calling sm_bi_copy. This ensures that all onscreen occurrences are copied.