The following section provides information about performing the additional Apply program functions of scheduling subscriptions, refreshing target tables, returning control to users, and initiating a forward recovery.
You can include an event name in your replication subscription. Your subscription cycles can run according to a timer, an event occurrence, or both. See "Setting the Copying Schedule: Time or Event Based" for more information about the purpose and usage of event scheduling.
You can schedule a subscription by manipulating the event table. The DDL statement for the event table appears as follows:
CREATE TABLE ASN.IBMSNAP_SUBS_EVENT ( EVENT_NAME CHAR(18) NOT NULL, EVENT_TIME TIMESTAMP NOT NULL, END_OF_PERIOD TIMESTAMP);
For example, to start the Apply program at 6:00 p.m. on 9/24/97 and copy changes from the source server up to 4:00 p.m. on the same date, you would insert the following values in ASN.IBMSNAP_SUBS_EVENT:
('EVENTA','1997-09-24-18.00.00.00000','1997-09-24-16.00.00.00000'),
A subscription becomes eligible for processing when EVENT_TIME falls between LASTSUCCESS and the control server's CURRENT TIMESTAMP. The END_OF_PERIOD column enables you to specify a timestamp upper limit for change data.
ASNLOAD is a user exit program that the Apply program invokes when you specify the LOADX invocation parameter. The Apply program calls the ASNLOAD program whenever it performs a full refresh of a target table.
You can use the ASNLOAD program as shipped with the Apply program, or you can modify it. As shipped, ASNLOAD uses the EXPORT utility to export data from the source table and uses the LOAD utility to fully refresh the target table.
You can modify ASNLOAD to call any IBM or vendor utility. See the prolog section in the sample program (ASNLOAD.SMP) for instructions on how to modify the program to meet the requirements of your installation.
You must use ASNLOAD to fully refresh tables with referential integrity constraints in order to bypass referential integrity checking.
If you invoke ASNLOAD, the following files are generated:
This file contains the data exported from the source.
This file contains error, warning, or informational messages issued by the EXPORT APIs.
This file contains error, warning, or informational messages issued by the LOAD APIs.
If an error occurs while the Apply program calls ASNLOAD, or if ASNLOAD returns a nonzero return code, the Apply program issues a message, stops processing that subscription, and processes the next subscription.
If you specify the NOTIFY parameter when starting the Apply program, the user exit program ASNDONE is called after subscription processing completes, regardless of success or failure. You can modify ASNDONE to meet the requirements of your installation. For example, the user exit can examine the UOW table to discover rejected transactions and initiate further actions, such as issuing a message or generating an alert.
See the prolog section in the sample program (ASNDONE.SMP) for instructions on how to modify the program.
In cases of an incomplete rollback or partially restored backup, you might need to copy a "window" of changes for completion.
To use the Apply program to limit the range of changes to those excluded from the rollback:
Check the IBMSNAP_LOGMARKER value in the point-in-time table. The highest value is the most recently committed change.
or
For example, if your timestamp shows the last committed change to be 941106174322, your SQL should reflect changes that occur after that time.