Replication Guide and Reference

Capture and Apply for AS/400

This chapter describes how to set up and operate the Capture and Apply programs for DB2 DataPropagator for AS/400 Version 7.

Be sure to read the following sections before reading the sections on operating the Capture and Apply programs for AS/400:


Coexistence considerations

You cannot run Version 1 of DB2 DataPropagator for AS/400 concurrently with Version 7. If you currently use Version 1, or if you use Version 1 replication components in a Version 5 DB2 DataPropagator for AS/400 environment, you must either:

You should use DJRA for all replication administration tasks. However, both DJRA and the DB2 Control Center provide basic replication administration functions for defining replication sources and subscription sets. Only DJRA provides support for remote journals and the use of a relative record number (RRN) as a primary key.


Setting up the Capture and Apply programs

Setting up the Capture and Apply programs consists of installing DB2 DataPropagator for AS/400 and tuning the Capture program for optimum productivity. This section describes how to set up the Capture and Apply programs.

Installing DB2 DataPropagator for AS/400

You install DB2 DataPropagator for AS/400 in the same way that you install any other licensed program. Follow these steps for the regular installation:

  1. Type GO LICPGM on the AS/400 command line.
  2. Select option 11 (Install licensed programs).
  3. Page down to locate DataPropagator Relational for AS/400 (5769DP3).

    If the window does not contain the product ID number (5769DP3) on the install screen, exit LICPGM and enter RSTLICPGM on the AS/400 command line, and then specify 5769DP3 for the product ID.

    If the window does contain the ID number, type a 1 next to it and press the Enter key.

Connecting to an AS/400 server

Before you connect to an AS/400 server from a DB2 for Windows NT or Windows 95 client, make sure that your workstation is set up correctly:

For example, use the following steps to connect to an AS/400 server from a DB2 for Windows NT workstation:

  1. Log on to the AS/400 server and locate the relational database:
    1. Log on to the AS/400 server to which you want to connect.
    2. Submit a dsprdbdire command, and then specify local for *LOCAL.
    3. Locate the name of the relational database in the output. For example, in the following output, the database is called DB2400E:
               MYDBOS2             9.112.14.67    
               RCHASDPD            RCHASDPD       
               DB2400E             *LOCAL         
               RCHASLJN            RCHASLJN       
       
      
  2. Catalog the AS/400 database in DB2 for Windows NT:
    1. From your Windows NT workstation, click Start->Programs->DB2 for Windows NT->Command Window. The DB2 CLP command window opens.
    2. In the command window, type the following three commands in exact order:
      db2 catalog tcpip node server_name remote server_name server 446 system 
      server_name ostype OS400 
       
      db2 catalog dcs database rdb_name AS rdb_name   
       
      db2 catalog database rdb_name AS rdb_name at node server_name 
      authentication dcs
      

      Where server_name is the TCP/IP host name of the AS/400 system, and rdb_name is the name of the AS/400 relational database that you found in Step 1.

  3. In the command window, issue the following command:
    db2 terminate
     
    
  4. Ensure that the AS/400 user profile that you will use to log on to your AS/400 system uses CCSID37:
    1. Log on to the AS/400 system.
    2. Type the following command, where user is the user profile:
      CHGUSRPRF USRPRF (user) CCSID(37)
      
    3. To make sure that DB2 for Windows NT and DB2 for AS/400 have been connected, issue the following command:
      db2 connect to rdb_name user user_name using password
      
  5. Make sure that the DDM server is started on the AS/400 system by typing:
    STRTCPSVR SERVER(*DDM)
    
  6. From your Windows NT workstation, use the Control Center or DJRA to administer the AS/400 database.

Verifying and customizing your installation of DB2 DataPropagator for AS/400

You should install DB2 DataPropagator for AS/400 before using the replication administration tools, because the installation process issues the CRTDPRTBL command to automatically create the replication control tables. These tables are created in the DataPropagator Relational collection (named ASN), if they do not already exist.

The installation program also creates an SQL journal, an SQL journal receiver for this library, and work management objects. Table 8 lists the work management objects that are created.

Table 8. Work management objects
Description Object type Name
Subsystem description *SBSD QDPR/QZSNDPR
Job queue *JOBQ QDPR/QZSNDPR
Job description *JOBD QDPR/QZSNDPR

A note on work management: You can alter the default definitions or provide your own definitions. See OS/400 Work Management V4R3, SC41-5306 for more information about changing these definitions.

Creating the replication control tables

If your replication control tables are accidentally deleted or corrupted, you can create them manually using the Create DPR Tables (CRTDPRTBL) command. You must have *ALLOBJ authority to run this command.

Important: The CRTDPRTBL command is the only command that you should use to create AS/400 control tables. Do not use DJRA to create the control tables.

>>-CRTDPRTBL----+----------------------+-----------------------><
                |          .-7--.      |
                '-DPRVSN(--+-5--+---)--'
 

Table 9. CRTDPRTBL command parameter definitions for AS/400
Parameter Definition and prompts
DPRVSN Specifies the version of the control tables to create.

7  (default) 
Specifies Version 7 control tables. The system creates all of the control tables for replication sources and targets along with the default SQL journal.

5
Specifies Version 5 control tables.

Specifying tuning parameters for Capture for AS/400

To control the performance of the Capture program, you can adjust four tuning parameters on the server by changing the values of columns in the tuning parameters table.

To specify the tuning parameters, do one of the following tasks:

Changing Capture program attributes

The Change DPR Capture Attributes (CHGDPRCAPA) command changes the global operating parameters in the tuning parameters table for the Capture program.

You can see the current values of the Capture program attributes if you issue the CHGDPRCAPA command with the F4 key to prompt on the command.

>>-CHGDPRCAPA----+---------------------------+------------------>
                 '-RETAIN(--+-*SAME---+---)--'
                            '-minutes-'
 
>-----+------------------------+-------------------------------->
      '-LAG(--+-*SAME---+---)--'
              '-minutes-'
 
>-----+---------------------------+----------------------------->
      '-FRCFRQ(--+-*SAME---+---)--'
                 '-seconds-'
 
>-----+---------------------------+----------------------------><
      '-CLNUPITV(--+-*SAME-+---)--'
                   '-1-100-'
 

Table 10. CHGDPRCAPA command parameter definitions for AS/400
Parameter Definition and prompts
RETAIN Specifies the new retention limit, which is the number of minutes that data is retained in the CD tables and the UOW table before it is removed.

The value of this parameter works with the CLNUPITV parameter. When the CLNUPITV value is reached, data in the CD and UOW tables is removed if the UOW table row shows that the transaction is older than the value of this parameter.

Ensure that the Apply intervals are set to copy changed information before the value on the RETAIN parameter is reached. This prevents your tables from becoming inconsistent. If they become inconsistent, the Apply program performs full refreshes.

*SAME  (default) 
Specifies that the value remains unchanged.

minutes
Specifies the number of minutes that the CD is retained. The maximum value is 35 000 000. The default value is 10 080 minutes (7 days).
LAG Specifies the new lag limit, which is the number of minutes that the Capture program can fall behind before clearing out the CD tables and starting over with change capture. When the lag limit is reached (that is, when the timestamp of the journal entry is older than the current time minus the lag limit), the Capture program assumes that it is too far behind to catch up. It then initiates a cold start for the tables that it is processing for that journal. The Apply program then performs a full refresh to provide the Capture program with a new starting point. Users typically set this value high so that it has no effect.

*SAME  (default) 
Specifies that the value remains unchanged.

minutes
Specifies the number of minutes that the CD entries are allowed to fall behind. The maximum value is 35 000 000. The default value is 10 080 minutes (7 days).
FRCFRQ Specifies approximately how often the Capture program writes changes to the CD and UOW tables.

The Capture program makes the changes available to the Apply program either when the buffers are filled or when this time has expired, whichever is sooner.

Use this parameter to make source table changes more readily available for the Apply program on servers with a low rate of source table changes.

This is a global value, and is used for all defined source tables. Setting this value at a lower number can affect processor usage.

*SAME  (default) 
Specifies that the value remains unchanged.

seconds
Specifies the number of seconds that the Capture program keeps CD table and UOW table changes in buffer space before making them available for use by the Apply program. This value can range from 30 to 600 seconds. The default value is 180 seconds.
CLNUPITV Specifies the maximum length of time before the Capture program prunes old records from the CD tables and the UOW table, if it exists. This parameter works with the RETAIN parameter.

The value of this parameter is converted from hours to seconds and stored in the PRUNE_INTERVAL column of the tuning parameters table. If the PRUNE_INTERVAL column is changed manually (not using the CHGDPRCAPA command), you might see changes due to rounding when you prompt using the F4 key.

*SAME  (default) 
Specifies that the value remains unchanged.

1-100
Specifies the maximum number of hours that you want the Capture program to wait before pruning. Valid values are 1-100.


Authorization requirements for running the Capture and Apply programs

This section describes the commands available for granting and revoking authority to the replication control tables: Granting authority and Revoking authority.

Granting authority

The Grant DPR Authority (GRTDPRAUT) command authorizes a list of users to the replication control tables, so that the users can run the Capture and Apply programs. For example, the authority requirements for the user who is running the Capture and Apply programs might differ from the authority requirements for the user who defines replication sources and targets.

You must have *ALLOBJ authority to grant authorities.

>>-GRTDPRAUT---USER(--+---user-name---+---)--------------------->
                      '-*PUBLIC-------'
 
                                          .-7--.
>----AUT(--+-*REGISTRAR--+---)---DPRVSN(--+-5--+---)------------>
           +-*SUBSCRIBER-+
           +-*CAPTURE----+
           '-*APPLY------'
 
               .-*ALL------------.
>----APYQUAL(--+-*USER-----------+---)-------------------------><
               '-apply-qualifier-'
 

Table 11. GRTDPRAUT command parameter definitions for AS/400
Parameter Definition and prompts
USER Specifies the users who have authority.

user-name
Specifies the names of up to 50 users who have authority.

*PUBLIC
Specifies that *PUBLIC authority is granted to the file, but (if insufficient for the task) is used only for those users who have no specific authority, who are not on the authorization list associated with the file, and whose group profile does not have any authority.
AUT Specifies the type of authority being granted.

*REGISTRAR  (default) 
Specifies that the users are granted the authorities to define, change, and remove subscription sets.

For a complete list of authorities with AUT(*REGISTRAR), see Table 12.

*SUBSCRIBER
Specifies that the users are granted authority to define, change, and remove subscription sets.

For a complete list of authorities with AUT(*SUBSCRIBER), see Table 13.

*CAPTURE
Specifies that the users are granted authority to run the Capture program.

For a complete list of authorities granted with AUT(*CAPTURE), see Table 14.

*APPLY
Specifies that the users are granted authority to run the Apply program.

The command does not grant authority to any of the objects that reside on other databases accessed by the Apply program.

When an Apply process is invoked, the user associated with the DRDA application server job must also be granted *APPLY authority. If the source is an AS/400 server, the GRTDPRAUT command should be run on the source server system, with the application server job user specified on the USER parameter and the Apply qualifier specified on the APYQUAL parameter.

Authorities are not granted to the target tables unless the target server is the same as the control server and both reside on the system where the command is run.

For a complete list of authorities granted with AUT(*APPLY), see Table 15.

DPRVSN Specifies the version of DB2 DataPropagator for AS/400.

7  (default) 
Specifies Version 7 of DB2 DataPropagator for AS/400.

5
Specifies Version 5 of DB2 DataPropagator for AS/400.
APYQUAL Specifies the Apply qualifier to be used by the user specified with the USER parameter. This parameter is used only when AUT(*APPLY) or AUT(*SUBSCRIBER) is specified.

*ALL  (default) 
Specifies that the user is granted authority to run the Apply program or to define and remove subscriptions for all Apply qualifiers.

*USER
Specifies that the users specified on the USER parameter are granted authority to subscriptions with an Apply qualifier that is the same as the user name.

apply-qualifier
Specifies that the user is granted authority to run the Apply program or define and remove subscriptions for the Apply qualifiers associated with this Apply qualifier.
  • The user is granted authority to all replication sources, CD tables, and CCD tables associated with records in the pruning control table that have a value in the APPLY_QUAL column matching the value input with the APYQUAL parameter.
  • The user is granted authority to the subscriptions listed in the subscription-targets-member table that reside on this system.

You cannot use the GRTDPRAUT command while the Capture or Apply programs are running, or when applications that use the source tables are active because authorizations cannot be changed on files that are in use.

Examples

Example 1

To authorize user USER1 to define and modify replication sources:

GRTDPRAUT USER(USER1) AUT(*REGISTRAR) DPRVSN(7)

Example 2

To authorize user USER1 to define and modify subscriptions:

GRTDPRAUT USER(USER1) AUT(*SUBSCRIBER) DPRVSN(7)

Example 3

To authorize user USER1 to define and modify existing subscriptions associated with Apply qualifier A1:

GRTDPRAUT USER(USER1) AUT(*SUBSCRIBER) DPRVSN(7) APYQUAL(A1)

Example 4

To authorize a user to run the Apply program on the control server system for all subscriptions associated with Apply qualifier A1, where the target server is the same as the control server:

  1. Run the following command on the system where the Apply program will run:
    GRTDPRAUT USER(USER1) AUT(*APPLY) DPRVSN(7) APYQUAL(A1)
    
  2. If the application server job on the source server used by the Apply program runs under user profile USER1, run the following command on the source server systems:
    GRTDPRAUT USER(USER1) AUT(*APPLY) DPRVSN(7) APYQUAL(A1)
    

    If the application server job on the source server used by the Apply program runs under a different user profile; for example, QUSER, the command is:

    GRTDPRAUT USER(QUSER) AUT(*APPLY) DPRVSN(7) APYQUAL(A1)
    

The levels of authority

The following tables list the authorities granted when you specify:

on the GRTDPRAUT command.

The following table lists the authorities granted when you specify the AUT(*REGISTRAR) parameter on the GRTDPRAUT command:

Table 12. Authorities granted with GRTDPRAUT AUT(*REGISTRAR)
Library Object Type Version Authorizations
QSYS ASN *LIB 5 7 *USE, *ADD
ASN QSQJRN *JRN 5 7 *OBJOPR, *OBJMGT
ASN IBMSNAP_REGISTER *FILE 7 *OBJOPR, *READ, *ADD, *UPD, *DLT
ASN IBMSNAP_REGISTERX *FILE 7 *OBJOPR, *READ, *ADD, *UPD, *DLT
ASN IBMSNAP_REG_EXT *FILE 5 7 *OBJOPR, *OBJMGT, *READ, *ADD, *UPD, *DLT
ASN IBMSNAP_REG_EXTX *FILE 5 7 *OBJOPR, *OBJMGT, *READ, *ADD, *UPD, *DLT
ASN IBMSNAP_UOW *FILE 5 7 *OBJOPR, *OBJMGT, *READ, *ADD *DLT
ASN IBMSNAP_UOW_IDX *FILE 5 7 *OBJOPR, *OBJMGT, *READ, *ADD, *DLT
ASN IBMSNAP_PRUNCNTL *FILE 7 *OBJOPR, *READ
ASN IBMSNAP_CCPPARMS *FILE 5 7 *OBJOPR, *READ, *UPD
ASN QZSNCTLBLK *USRSPC 5 7 *CHANGE
ASN ASN4B* *SQLPKG 7 *USE
ASN ASN4C* *SQLPKG 7 *USE
QSYS Source library *LIB 5 7 *USE
Source library Source table *FILE 5 7 *OBJOPR, *READ
QSYS Control library *LIB 5 7 *USE, *ADD
Control library CDtimestamp - CD table *FILE 7 *USE, *OBJMGT, *OBJEXIST

The following table lists the authorities granted when you specify the AUT(*SUBSCRIBER) parameter on the GRTDPRAUT command:

Table 13. Authorities granted with GRTDPRAUT AUT(*SUBSCRIBER)
Library Object Type Version Authorizations
QSYS ASN *LIB 7 *USE, *ADD
QSYS IBMSNAP_SUBS_SET *FILE 7 *CHANGE
ASN IBMSNAP_APPLYTRAIL *FILE 7 *CHANGE
ASN IBMSNAP_SUBS_COL *FILE 7 *CHANGE
ASN IBMSNAP_SUBS_EVENT *FILE 7 *CHANGE
ASN IBMSNAP_SUBS_STMTS *FILE 7 *CHANGE
ASN IBMSNAP_SUBS_MEMBR *FILE 7 *CHANGE
ASN IBMSNAP_REGISTER *FILE 7 *USE, *UPD
ASN IBMSNAP_REG_EXT *FILE 5 7 *USE, *UPD
ASN IBMSNAP_PRUNCNTL *FILE 7 *USE, *ADD, *DLT
ASN ASN4U* *SQLPKG 7 *USE
ASN ASN4A* *SQLPKG 7 *USE
QSYS Source library *LIB 5 7 *USE
Source library Source table *FILE 5 7 *OBJOPR, *READ
QSYS Control library *LIB 7 *USE
Control library ASNtimestampPC - pruning control table *LIB 7 *USE
Control library CD table *FILE 5 7 *OBJOPR, *READ
Control library Internal CCD table *FILE 5 7 *OBJOPR, *READ
QSYS Target library *LIB 7 *USE, *ADD
Target library Target table *FILE 7 *USE, *OBJMGT, *OBJEXIST

The following table lists the authorities granted when you specify the AUT(*CAPTURE) parameter on the GRTDPRAUT command:

Table 14. Authorities granted with GRTDPRAUT AUT(*CAPTURE)
Library Object Type Version Authorizations
QSYS ASN *LIB 5 7 *USE, *OBJMGT
ASN IBMSNAP_REGISTER *FILE 5 7 *USE, *UPD
ASN IBMSNAP_REG_EXT *FILE 5 7 *USE, *UPD
QSYS Control library *LIB 5 7 *USE
Control library CD table *FILE 5 7 *OBJOPR, *OBJMGT, *READ, *UPD, *DLT, *ADD
Control library CD table *FILE 5 7 *OBJOPR, *OBJMGT, *READ, *UPD, *DLT, *ADD
ASN IBMSNAP_PRUNCNTL *FILE 7 *USE, *UPD
ASN IBMSNAP_CRITSEC *FILE 7 *USE
ASN IBMSNAP_CCPPARMS *FILE 5 7 *USE
ASN IBMSNAP_UOW *FILE 5 7 *CHANGE
ASN IBMSNAP_TRACE *FILE 7 *CHANGE
ASN IBMSNAP_WARM_START *FILE 7 *CHANGE
ASN IBMSNAP_AUTHTKN *FILE 7 *CHANGE
ASN QZSBCTKBLK *USRSPC 5 7 *CHANGE
ASN ASNB* SQLPKG 7 *USE
ASN ASNC* SQLPKG 7 *USE

The following table lists the authorities granted when you specify the AUT(*APPLY) parameter on the GRTDPRAUT command:

Table 15. Authorities granted with GRTDPRAUT AUT(*APPLY)
Library Object Type Version Authorizations
QSYS ASN *LIB 5 7 *USE
ASN IBMSNAP_SUBS_SET *FILE 7 *CHANGE
ASN IBMSNAP_APPLYTRAIL *FILE 7 *CHANGE
ASN IBMSNAP_SUBS_COLS *FILE 7 *USE
ASN IBMSNAP_SUBS_EVENT *FILE 7 *USE
ASN IBMSNAP_SUBS_STMTS *FILE 7 *USE
ASN IBMSNAP_SUBS_MEMBR *FILE 7 *USE
ASN ASNA* *SQLPKG 7 *USE
ASN ASNU* *SQLPKG 7 *USE
ASN IBMSNAP_REGISTER *FILE 7 *USE, *UPD
ASN IBMSNAP_REG_EXT *FILE 5 7 *USE, *UPD
ASN IBMSNAP_UOW *FILE 5 7 *USE, *UPD
ASN IBMSNAP_PRUNCNTL *FILE 7 *USE, *UPD, *ADD
ASN IBMSNAP_CRITSEC *FILE 7 *USE, *ADD
ASN IBMSNAP_AUTHTKN *FILE 7 *USE, *ADD
QSYS Control library *LIB 5 7 *USE
Control library CD table *FILE 5 7 *USE
QSYS Target library *LIB 7 *USE
Target library Target table *FILE 7 *CHANGE, *OBJMGT

Revoking authority

The Revoke DPR Authority (RVKDPRAUT) command revokes authority to the replication control tables so that users can no longer define or modify replication sources and subscriptions.

                        .----------------.
                        V                |                  .-7--.
>>-RVKDPRAUT--USER(--+------user-name----+-+---)---DPRVSN(--+-5--+---)-->
                     '-*PUBLIC-------------'
 
>--------------------------------------------------------------><
 

The command returns an error message if any of the following conditions exist:


Table 16. RVKDPRAUT command parameter definitions for AS/400
Parameter Definition and prompts
USER Specifies the users whose authority is revoked.

user-name
Specifies the names of up to 50 users whose authority is revoked.

*PUBLIC
Specifies that authority is revoked from all users without specific authority, who are not on the authorization list, and whose group profile does not have any authority.
DPRVSN Specifies the version of DB2 DataPropagator for AS/400.

7  (default) 
Revoke authorities for Version 7 of DB2 DataPropagator for AS/400.

5
Revoke authorities for Version 5 of DB2 DataPropagator for AS/400.

Example

To revoke authorities to the control tables:

RVKDPRAUT USER(user-name) DPRVSN(7)

Restrictions for running the Capture program

If you perform any of the following actions while a Capture journal job is running, it terminates with message ASN2301 or ASN2201 in the job log:

To keep the Capture program running, use the following guidelines:

When conditions make capturing data for a particular source table impossible, the Capture program changes the state of the source table from capturing changes to needing a full refresh. (See Table 20 for a list of such conditions.) Other conditions that prevent data capturing for a source table are:


The journal

DB2 DataPropagator for AS/400 uses the information that it receives from the journals about changes to the data to populate the CD and UOW tables for replication.

DB2 DataPropagator for AS/400 runs under commitment control for most operations and therefore requires journaling on the control tables. (The QSQJRN journal is created when the CRTDPRTBL command creates a collection.)

Administrators must manually create the QSQJRN journal in both the library that contains the replication source control tables and the library that contains the target tables. Administrators must also ensure that all the source tables are journaled correctly.

Remote journal function

In previous versions of DB2 DataPropagator for AS/400, replication source definitions (including the control tables associated with a source) and the Capture program always resided on the same system. The remote journal function makes it possible to move the replication source definitions and the Capture program and its control tables away from the system on which the source tables reside, leaving more resources available on that system. With the remote journal function, processor usage can be reduced, DASD can be saved, and performance can be improved significantly.

Important: The intention of this type of setup is to have the replication source definitions on the same AS/400 system as the replication target.

A replication source definition that refers to a remote source table cannot be subscribed to by other platforms such as the Apply program for OS/390 or the Apply program for UNIX.

To define a replication source with remote journals, select Define One Table as a Replication Source from the DJRA main window, select an AS/400 source table, then select the AS/400 policies tab. From this tab, select the remote journal checkbox, and enter the remote journal library, remote journal name, and Capture server.

For more information about the remote journal function, see AS/400 Remote Journal Function for High Availability and Data Replication, SG24-5189.

Creating journals for source tables

To set up the source table journals, you must have the authority to create journals and journal receivers for the source tables to be defined.

Important: Use a different journal for the source tables than one of those created by DB2 DataPropagator for AS/400 (QSQJRN journals) in the ASN library, the source library, the control library, or the target library.

To create a source table journal:

  1. Create a journal receiver in a library of your choice using the Create Journal Receiver (CRTJRNRCV) command. The following example uses a library named JRNLIB for journal receivers.
    CRTJRNRCV  JRNRCV(JRNLIB/RCV0001)
               THRESHOLD(50000)
               TEXT('DataPropagator Journal Receiver')
     
    

    Be sure to:

  2. Create the journal by using the Create Journal (CRTJRN) command:
    CRTJRN  JRN(JRNLIB/DJRN1)
            JRNRCV(JRNLIB/RCV0001)
            MNGRCV(*SYSTEM) DLTRCV(*YES)
            TEXT('DataPropagator Journal')
     
    

    Be sure to:

    You can use two values on the RCVSIZOPT parameter of the CRTJRN command (*RMVINTENT and *MINFIXLEN) to optimize your storage availability and system performance. See the AS/400 Programming: Performance Tools Guide for more information.

  3. Start journaling the source table using the Start Journal Physical File (STRJRNPF) command, as in the following example:
    STRJRNPF FILE(library/file)
             JRN(JRNLIB/DJRN1)
             OMTJRNE(*OPNCLO)
             IMAGES(*BOTH)
     
    
    Specify the name of the journal that you created in step 2. The Capture program requires a value of *BOTH for the IMAGES parameter.

Managing journals and journal receivers

The Capture program uses the Receive Journal Entry (RCVJRNE) command to receive journals.

Specifying system management of journal receivers

It is recommended that you let the AS/400 system manage the changing of journal receivers. This is called system change journal management. Specify MNGRCV(*SYSTEM) when you create the journal, or change the journal to that value. If you use system change journal management support, you must create a journal receiver that specifies the threshold at which you want the system to change journal receivers. The threshold must be at least 5000 KB, and should be based on the number of transactions on your system. The system automatically detaches the receiver when it reaches the threshold size and creates and attaches a new journal receiver, if it can.

Specifying user management of journal receivers

If you specify MNGRCV(*USER) when you create the journal (meaning you want to manage changing your own journal receivers), a message is sent to the journal's message queue when the journal receiver reaches a storage threshold, if one was specified for the receiver.

Use the CHGJRN command to detach the old journal receiver and attach a new one. This command prevents Entry not journaled error conditions and limits the amount of storage space that the journal uses. To avoid affecting performance, do this at a time when the system is not at maximum use.

You can switch journal receiver management back to the system by specifying CHGJRN MNGRCV(*SYSTEM).

You should regularly detach the current journal receiver and attach a new one for two reasons:

The default message queue for a journal is QSYSOPR. If you have a large volume of messages in the QSYSOPR message queue, you might want to associate a different message queue, such as DPRUSRMSG, with the journal. You can use a message handling program to monitor the DPRUSRMSG message queue. For an explanation of messages that can be sent to the journal message queue, see OS/400 Backup and Recovery.

Using the delete journal receiver exit routine

When you install DB2 DataPropagator for AS/400 on a V4R2 (or later) system, a delete journal receiver exit routine (DLTJRNRCV) is registered automatically. This exit routine is called any time a journal receiver is deleted, whether or not it is used for journaling the source tables. This exit routine determines whether or not a journal receiver can be deleted. (You no longer need to do this manually. Nor do you need to use the ANZDPRJRN command to delete old receivers.)

To take advantage of the delete journal receiver exit routine and leave journal management to the system, specify DLTRCV(*YES) and MNGRCV(*SYSTEM) on the CHGJRN or CRTJRN command.

If the journal that the receiver is associated with has no association with any of the source tables, this exit routine approves the deletion of the receiver.

If the journal receiver is used by one or more source tables, this exit routine makes sure that the receiver being deleted does not contain entries that have not been processed by the Capture program. The exit routine disapproves the deletion of the receiver if the Capture program still needs to process entries on that receiver.

If you must delete a journal receiver and the delete journal receiver exit routine does not approve the deletion, specify DLTJRNRCV DLTOPT(*IGNEXITPGM) to override the exit routine.

Removing the delete journal receiver exit routine

If you want to handle the deletion of journal receivers manually, you can remove the delete journal receiver exit routine by issuing the following command:

RMVEXITPGM EXITPNT (QIBM_QJO_DLT_JRNRCV)
           FORMAT(DRVC0100)
           PGMNBR(value)
 

To determine the PGMNBR value for the RMVEXITPGM command:

  1. Issue the WRKREGINF command.
  2. On the Work with Registration Information window, find the entry for exit point QIBM_QJO_DLT_JRNRCV. Enter 8 in the Opt field.
  3. On the Work with Exit Programs window, find the entry for Exit Program QZSNDREP in library QDPR. The number that you need is under the Exit Program Number heading.

Registering the delete journal receiver exit routine for upgraded systems

If the 5769DP3 version of DB2 DataPropagator for AS/400 was installed on V4R1 and the operating system was upgraded to V4R2 or V4R3 without reinstalling the product, you must register the exit routine with this command:

ADDEXITPGM EXITPNT(QIBM_QJO_DLT_JRNRCV)
           FORMAT(DRCV0100)
           PGMNBR(value *LOW)
           CRTEXITPNT(*NO)
           PGM(QDPR/QZSNDREP)
 

Defining replication sources and subscription sets

Before you define source tables as replication sources with DB2 DataPropagator for AS/400, you must be authorized to the control tables.

There are no commands in DB2 DataPropagator for AS/400 for defining replication sources and subscription sets. Use the DB2 DataJoiner Replication Administration tool (DJRA) to define replication sources and subscription sets. Before you define a table as a replication source, the source table must be journaled for both before-images and after-images, and the library where the CD table is created must have a QSQJRN journal.

In DB2 DataPropagator for AS/400, the tables you define as replication sources can contain approximately 2000 columns; the exact number of columns depends on the length of the name of each column. This limitation exists because character strings supplied by the Apply program for AS/400 cannot exceed 32K.

When you define tables as replication sources, the CCSID attributes of CHAR, VARCHAR, GRAPHIC, and VARGRAPHIC columns in the CD table must be the same as the CCSID column attributes of the source table.


Using a relative record number (RRN) as a primary key

In DB2 DataPropagator for AS/400, many source tables do not have a column that can be identified as a primary key column. DB2 DataPropagator requires primary key columns for the Apply program to track which updates are applied to which target table rows. To meet this requirement, DB2 DataPropagator for AS/400 supports the use of relative record numbers (RRNs) of source table rows as primary key columns. Both the CD table and the target table have an extra column, IBMQSQ_RRN, of type INTEGER. This column has the RRN of the source table row.

Because the RRN of a source table row does not change unless the source table is reorganized, the RRN value can be used as a primary key for the source table row if a source table is not reorganized. Any time that you reorganize a source table (to compress deleted rows, for example), DB2 DataPropagator for AS/400 performs a full refresh of all the target tables.

Important: Only the Apply program for AS/400 can be used to maintain copies that contain RRN columns, whether these copies are on an AS/400 or other target DB2 platforms.

To define a replication source with a RRN column, select Define One Table as a Replication Source from the DJRA main window, select an AS/400 source table, then select the AS/400 policies tab. From this tab, select the RRN checkbox.


Operating Capture for AS/400

The replication administrator user ID and users who have *CAPTURE authority can use the commands in this section to perform the following Capture for AS/400 tasks:

This section also describes how the Capture program handles warm and cold starts, in Warm and cold starts.

Starting Capture for AS/400

Use the Start DPR Capture (STRDPRCAP) command to start capturing changes to AS/400 database tables. Because this command processes all replication sources in the register table, make sure that the user running this command has the proper authority.

After you start the Capture program, it runs continuously until you stop it or it detects an unrecoverable error.

>>-STRDPRCAP----+--------------------------+-------------------->
                |           .-*YES--.      |
                '-RESTART(--+-*NO---+---)--'
 
>-----+---------------------------------------------------+----->
      |        .-*LIBL/QZSNDPR---------------------.      |
      '-JOBD(--+-library-name/job-description-name-+---)--'
 
>-----+----------------------+---+-----------------------+------>
      |          .-7--.      |   |        .-120---.      |
      '-DPRVSN(--+-5--+---)--'   '-WAIT(--+-value-+---)--'
 
>-----+--------------------------------------------------+------>
      |            .-*DPRVSN-------.   .-*IMMED---.      |
      '-CLNUPITV(--+-*GLOBAL-------+---+-*DELAYED-+---)--'
                   '-hours-to-wait-'   '-*NO------'
 
>-----+-------------------------------------------------+------->
      |       .-*ALL-----------------------------.      |
      |       |  .-----------------------------. |      |
      |       |  V                             | |      |
      '-JRN(--+----library-name/journal-name---+-+---)--'
 
>-----+--------------------------------+-----------------------><
      |            .-*ALLCHG----.      |
      '-GENCDROW(--+-*REGCOLCHG-+---)--'
 

Table 17. STRDPRCAP command parameter definitions for AS/400
Parameter Definition and prompts
RESTART Specifies how the Capture program handles warm and cold starts.

*YES  (default) 
The Capture program continues processing the changes from the point where it was when it ended previously. This is also known as a warm start and is the normal mode of operation.

*NO
The Capture program removes all information from the CD tables. The Capture program also removes all information from the UOW table when you specify JRN(*ALL).

All subscriptions for affected source tables are full refreshed before change capturing resumes. This process is also known as a cold start.

At times you might want to cold start a subset of sources. By specifying RESTART(*NO) and JRN(library-name/journal-name), you can cold start the Capture program for specified journals.

When you cold start a subset of sources, the information in the UOW table is not removed. When you use the STRDPRCAP command to cold start a subset of sources, you can end the Capture program after about 15 minutes and warm start it again (this time, starting all the replication sources).

JOBD Specifies the name of the job description to use when submitting the Capture program.

*LIBL/QZSNDPR  (default) 
Specifies the default job description provided with DB2 DataPropagator for AS/400.

library-name/job-description-name
Represents the name of the job description used for the Capture program.
DPRVSN Specifies the version of the Capture program to start.

7  (default) 
Start Version 7 of the Capture program.

5
Start Version 5 of the Capture program.
WAIT Specifies the maximum number of seconds to wait before the Capture program checks its status. You can use this value to tune the responsiveness of the Capture program. A low value reduces the time that the Capture program takes before ending or initializing, but can have a negative effect on system performance. A higher value increases the time that the Capture program takes before ending or initializing, but can improve system performance. A value that is too high can result in decreased responsiveness while the Capture program is performing periodic processing. The amount of the decrease in responsiveness depends on the amount of change activity to source tables and the amount of other work occurring on the system.

120  (default) 
The Capture program waits 120 seconds.

value
The maximum number of seconds that the Capture program waits. You can specify from 60 to 6000 seconds.
CLNUPITV Specifies the maximum amount of time before the Capture program prunes old records from the CD tables and the UOW table, if it exists. This parameter works in conjunction with the RETAIN parameter on the CHGDPRCAPA command.

*DPRVSN  (default) 
Specifies the interval. The value is *GLOBAL.

*GLOBAL
Specifies the interval as the same value as that of the PRUNE_INTERVAL column of the tuning parameters table. You can change this value by using the CLNUPITV parameter on the CHGDPRCAPA command.

hours-to-wait
Specifies the interval as a specific number of hours.

*IMMED  (default) 
Specifies to prune old records at the beginning of the specified interval (or immediately), and at each interval thereafter.

*DELAYED
Specifies that the Capture program prune old records at the end of the specified interval, and at each interval thereafter.

*NO
Specifies that the Capture program does not prune records.
JRN Specifies a subset of up to 50 journals that you want the Capture program to work with. The Capture program will start processing all the source tables that are currently journaled to this journal.

*ALL
Specifies that the Capture program will start working with all of the journals that have any source tables journaled to them.

library-name/journal-name
Represents the qualified name of the journal that you want the Capture program to work with.
GENCDROW Specifies what changes from the journals should be copied into the change data table.

*ALLCHG
All of the insert, update, and delete records from the journal are copied into the change data table.

*REGCOLCHG
The insert, update, and delete changes made to the registered columns are journaled, and the changes are then copied into the change data table. Changes that are made to columns that are not defined for replication will not be captured in the change data tables.

You can run the STRDPRCAP command manually, or you can automatically run the command as a part of the initial program load (IPL startup program). For information about including the STRDPRCAP command in a startup program, see OS/400 Work Management V4R3, SC41-5306.

If the job description specified with the JOBD parameter uses job queue QDPR/QZSNDPR, and the DB2 DataPropagator for AS/400 subsystem is not active, the STRDPRCAP command starts the subsystem. If the job description is defined to use a different job queue and subsystem, you must start this subsystem manually with the Start Subsystem (STRSBS) command either before or after running the STRDPRCAP command:

STRSBS QDPR/QZSNDPR
 

You can set up the system to start the subsystem automatically by adding the STRSBS command to the program that is referred to in the QSTRUPPGM system value on your system.

Determining the progress of the Capture program

To determine the progress of the Capture program, you must either determine how much work remains between the last Capture process that was performed and the last Apply process, or use the DJRA Replication Monitor.

If the Capture program has ended, you can determine its progress by inspecting the warm start table. There is one row for each journal used by the source tables. The LOGMARKER column provides the timestamp of the last journal entry processed successfully. The SEQNBR column provides the journal entry sequence number of that entry.

If the Capture program is still running, you can determine its progress by completing the following tasks:

  1. For each source table being captured, find its CD table.
  2. In the last row of the CD table, note the hex value in the IBMSNAP_UOWID column.
  3. Look in the UOW table for a row with the same IBMSNAP_UOWID value. If no matching IBMSNAP_UOWID exists in the UOW table, repeat the same process with the second-to-last row in the CD table. Proceed backward through the CD table until you find a match.
  4. When you find a matching IBMSNAP_UOWID, note the value in the IBMSNAP_LOGMARKER column of the UOW row. This is the timestamp of the processed journal entry. All changes to the source table up to that time are ready to be applied.
  5. Use the Display Journal (DSPJRN) command to determine how many journal entries remain to be processed by the Capture program. Direct the output to an output file (or to a printer for a printed report), as shown in the following example:
    DSPJRN FILE(JRNLIB/DJRN1)
           RCVRNG(*CURCHAIN)
           FROMTIME(timestamp)
           TOTIME(*LAST)
           JRNCDE(J F R C)
           OUTPUT(*OUTFILE)
           ENTDTALEN(1) OUTFILE(library/outfile)
     
    

    In the example, timestamp is the timestamp that you identified in step 4.

    The number of records in the output file is the approximate number of journal entries that remain to be processed by the Capture program.

Scheduling Capture for AS/400

Use the SBMJOB command to schedule the start of the Capture program on AS/400:

SBMJOB CMD('STRDPRCAP...') SCDDATE(...) SCDTIME(...)
 

Stopping Capture for AS/400

Use the End DPR Capture (ENDDPRCAP) command to end the Capture program.

Use this command to end the Capture program before shutting down the system. You might also want to end the program during periods of peak system use to increase the performance of other programs that run on the system.

>>-ENDDPRCAP----+----------------------------+------------------>
                |          .-*CNTRLD--.      |
                '-OPTION(--+-*IMMED---+---)--'
 
>-----+----------------------+---------------------------------><
      |          .-7--.      |
      '-DPRVSN(--+-5--+---)--'
 

Table 18. ENDDPRCAP command parameter definitions for AS/400
Parameter Definition and prompts
OPTION Specifies how to end the Capture program.

*CNTRLD  (default) 
Specifies that the Capture program complete all tasks and then end normally.

The ENDDPRCAP command might take longer when you specify the *CNTRLD option because the Capture program completes all of its subordinate processes before ending.

*IMMED
Specifies that the Capture program complete all tasks with the ENDJOB OPTION(*IMMED) command and end normally.
DPRVSN Specifies the version of the Capture program to end.

7  (default) 
Specifies Version 7 of the Capture program.

5
Specifies Version 5 of the Capture program.

If you use the ENDJOB command, temporary objects might be left in the QDPR library. These objects have the types *DTAQ and *USRSPC, and are named QDPRnnnnnn, where nnnnnn is the job number of the job that used them. You can delete these objects when the job that used them (identified by the job number in the object name) is not active.

If the job QDPRCTL5 does not end long after issuing this command, use the ENDJOB command with *IMMED option to end this job and all the journal jobs running in the DB2 DataPropagator for AS/400 subsystem. Do not end Apply jobs running in the same subsystem if you want to end only the Capture program.

In rare cases when the job QDPRCTL5 ends abnormally, the journal jobs created by QDPRCTL5 might still be left running. The only way to end these jobs is to use the ENDJOB command with either the *IMMED or *CNTRLD option.

Reinitializing Capture for AS/400

The Initialize DPR Capture (INZDPRCAP) command initializes the Capture program by directing the Capture program to work with an updated list of source tables.

Source tables under the control of the program can change while the Capture program is running. Use the INZDPRCAP command to ensure that the Capture program processes the most up-to-date replication sources.

If you change the values of the tuning parameters while the Capture program is running, enter the INZDPRCAP command to reinitialize the program using the new values.

The Capture program must be running before you run this command.

>>-INZDPRCAP----+----------------------+------------------------>
                |          .-7--.      |
                '-DPRVSN(--+-5--+---)--'
 
>-----+-------------------------------------------------+------><
      |       .-*ALL-----------------------------.      |
      |       |  .-----------------------------. |      |
      |       |  V                             | |      |
      '-JRN(--+----library-name/journal-name---+-+---)--'
 

Table 19. INZDPRCAP command parameter definitions for AS/400
Parameter Definition and prompts
DPRVSN Specifies the version of the Capture program to initialize.

7  (default) 
Specifies Version 7 of the Capture program.

5
Specifies Version 5 of the Capture program.
JRN Specifies a subset of up to 50 journals that you want the Capture program to work with. The Capture program will start processing all the source tables that are currently journaled to this journal.

*ALL  (default) 
Specifies that the Capture program works with all the journals.

library-name/journal-name
Specifies the qualified name of the journal that you want the Capture program to work with.

Pruning the change data and unit-of-work tables and minimizing source server DASD usage

The CLNUPITV parameter on the STRDPRCAP command specifies the maximum number of hours that the Capture program waits before pruning old records from the CD tables and the UOW table. For more information about the CLNUPITV parameter, see Starting Capture for AS/400.

Pruning does not recover DASD for you. You have to frequently issue RGZPFM (Reorganize Physical File Member) commands against the CD tables and the UOW tables to recover the DASD. The RGZPFM command reclaims deleted space by moving active rows forward. It requires an EXCLRD lock of the file and member, and you must schedule it when Capture and Apply are not running.

Important: Issue RGZPFM commands once a week.

Warm and cold starts

The value of the RESTART parameter on the STRDPRCAP command controls how the Capture program handles warm and cold starts.

Warm start process

Warm start information is saved in most cases. Occasionally, warm start information is not saved. In this case, the Capture program uses the CD tables, UOW table, or the pruning control table to resynchronize to the time that it was stopped.

Automatic cold starts

Sometimes the Capture program automatically switches to a cold start, even if you specified a warm start. On AS/400 systems, cold starts work on a journal-by-journal basis. So, for example, if a journal exceeds the lag limit, all replication sources using that journal are cold-started, whereas replication sources using a different journal are not cold started.

For more information about how the Capture program processes different journal entry types, see Table 20.


How the Capture program processes journal entry types

The following table describes how the Capture program processes different journal entry types.

Table 20. Capture program processing by journal entry
Journal code3 Entry type Description Processing
C CM Set of record changes committed Insert a record in the UOW table.
C RB Rollback No UOW row inserted.
F AY Journaled changes applied to physical file member Issue an ASN2004 message and full refresh of file.
F CE Change end of data for physical file Issue an ASN2004 message and full refresh of file.
F CR Physical file member cleared Issue an ASN2004 message and full refresh of file.
F EJ Journaling for physical file member ended Issue an ASN2004 message and full refresh of file.
F IZ Physical file member initialized Issue an ASN2004 message and full refresh of file.
F MD Member removed from physical file (DLTLIB, DLTF, or RMVM) Issue an ASN2004 message and attempt a full refresh.
F MF Storage for physical file member freed Issue an ASN2004 message and full refresh of file.
F MM Physical file containing member moved (Rename Object (RNMOBJ) of library, Move Object (MOVOBJ) of file) Issue an ASN200A message and attempt a full refresh.
F MN Physical file containing member renamed (RNMOBJ of file, Rename Member (RNMM)) Issue an ASN200A message and attempt a full refresh.
F MR Physical file member restored Issue an ASN2004 message and full refresh of file.
F RC Journaled changes removed from physical file member Issue an ASN2004 message and full refresh of file.
F RG Physical file member reorganized If the RRN of the source table is being used as the replication key, issue an ASN2004 message and full refresh of file.
J NR Identifier for next journal receivers Reset the Capture program.
J PR Identifier for previous journal receivers Increment the unique sequence number counter.
R DL Record deleted from physical file member Insert a DLT record in the CD table.
R DR Record deleted for rollback Insert a DLT record in the CD table.
R PT Record added to physical file member Insert an ADD record in the CD table.
R PX Record added directly to physical file member Insert an ADD record in the CD table.
R UB Before-image of record updated in physical file member See note 1.
R UP After-image of record updated in physical file member See note 1.
R BR Before-image of record updated for rollback See note 2.
R UR After-image of record updated for rollback See note 2.

Notes:

  1. The R-UP image and the R-UB image form a single UPD record in the CD table if the PARTITION_KEYS_CHG column in the register table is N. Otherwise, the R-UB image inserts a DLT record in the CD table and the R-UP image inserts an ADD record in the CD table.

  2. The R-UR image and the R-BR image form a single UPD record in the CD table if the PARTITION_KEYS_CHG column in the register table is N. Otherwise, the R-BR image inserts a DLT record in the CD table and the R-UR image inserts an ADD record in the CD table.

  3. The following values are used for the journal codes:

    C
    Commitment control operation

    F
    Database file operation

    J
    Journal or journal receiver operation

    R
    Operation on specific record

All other journal entry types are ignored by the Capture program.


Operating Apply for AS/400

A replication administrator user ID and users who have *APPLY authority can use the commands in this section to perform the following Apply for AS/400 tasks:

This section also describes two additional Apply program operations:

Creating packages to use with remote systems

SQL and DPR packages can be created to use with remote systems. You can create these packages by issuing the following commands:

CRTSQLPKG
The Create SQL Package (CRTSQLPKG) command creates the packages that enable you to use Apply for AS/400 with remote systems on platforms other than AS/400. For information about using this command, see DB2 for AS/400 SQL Programming V4R3 or later.

CRTDPRPKG
You can use the Create DPR Packages (CRTDPRPKG) command to create the packages necessary to use DB2 DataPropagator for AS/400 with remote systems. The following paragraphs contain more information about using this command.
>>-CRTDPRPKG----+---------------------+------------------------->
                |         .-7--.      |
                '-DPRVSN--+-5--+---)--'
 
>-----+-----------------------+---+------------------------+---><
      |       .-*ALL---.      |   |      .-*ALL-----.      |
      '-TYPE--+-*APPLY-+---)--'   '-RDB--+-rdb-name-+---)--'
              '-*ADMIN-'
 

Table 21. CRTDPRPKG command parameter definitions for AS/400
Parameter Definition and prompts
DPRVSN Specifies the version of the DB2 DataPropagator for AS/400 package to use.

7  (default) 
Specifies packages for Version 7 of DB2 DataPropagator for AS/400.

5
Specifies packages for Version 5 of DB2 DataPropagator for AS/400.
TYPE Specifies which DB2 DataPropagator for AS/400 packages are created.

*ALL  (default) 
Specifies to create packages for all the DB2 DataPropagator for AS/400 programs that do remote SQL.

*APPLY
Specifies to create the packages for the programs used by the Apply program.

*ADMIN
Specifies to create the packages for the programs used by the CL commands.
RDB Specifies the relational database where the packages are created. The packages are not created in the following cases:
  • The RDB is on an AS/400 system and the ASN library does not exist on the remote system.
  • The RDB is not on an AS/400 system and ASN is not defined as an authorization ID on that RDB.

*ALL  (default) 
Specifies to create an SQL package on every RDB that is used as a source server or a target server by DB2 DataPropagator for AS/400.

rdb-name
Represents the name of the relational database. You can use the Work with RDB Directory Entries (WRKRDBDIRE) command to find this name.

When prompting on the CRTDPRPKG command, you can press the F4 key to choose from the list of databases in the RDB directory.

The packages are created using the ASN qualifier. They are created in the ASN library for DB2 UDB for AS/400 platforms. For other platforms, the authorization ID ASN is used.

After creating the DB2 DataPropagator for AS/400 packages, this command grants *PUBLIC authority to the packages to allow them to be used by users of DB2 DataPropagator for AS/400.

The system also produces a spool file that contains the SQL messages associated with each attempt to create a package.

Before you start the Apply program

Before you start the Apply program, ensure that:

Starting Apply for AS/400

The Start DPR Apply (STRDPRAPY) command starts an instance of the Apply program on the local system. The Apply program continues running until you stop it or an unrecoverable error occurs.

>>-STRDPRAPY----+---------------------------+------------------->
                |        .-*CURRENT--.      |
                '-USER(--+-*JOBD-----+---)--'
                         '-user-name-'
 
>-----+---------------------------------------------------+----->
      |        .-*LIBL/QZSNDPR---------------------.      |
      '-JOBD(--+-library-name/job-description-name-+---)--'
               '-*LIBL/job-description-name--------'
 
>-----+----------------------+---------------------------------->
      |          .-7--.      |
      '-DPRVSN(--+-5--+---)--'
 
>-----+------------------------------------+-------------------->
      |           .-*USER-----------.      |
      '-APYQUAL(--+-apply-qualifier-+---)--'
 
>-----+----------------------------+---------------------------->
      |          .-*LOCAL---.      |
      '-CTLSVR(--+-rdb-name-+---)--'
 
>-----+-------------------------+------------------------------->
      |         .-*NONE--.      |
      '-TRACE(--+-*ERROR-+---)--'
                +-*ALL---+
                '-*PRF---'
 
>-----+-------------------------------------------------+------->
      |              .-*NONE---------------------.      |
      '-FULLREFPGM(--+-library-name/program-name-+---)--'
 
>-----+------------------------------------------------+-------->
      |             .-*NONE---------------------.      |
      '-SUBNFYPGM(--+-library-name/program-name-+---)--'
 
>-----+---------------------------+----------------------------->
      |            .-*YES--.      |
      '-INACTMSG(--+-*NO---+---)--'
 
>-----+---------------------------+----------------------------->
      |            .-*YES--.      |
      '-ALWINACT(--+-*NO---+---)--'
 
>-----+-----------------------------+--------------------------->
      |         .-6----------.      |
      '-DELAY(--+-delay-time-+---)--'
 
>-----+------------------------------------+-------------------><
      |           .-300-------------.      |
      '-RTYWAIT(--+-retry-wait-time-+---)--'
 

Table 22. STRDPRAPY command parameter definitions for AS/400
Parameter Definition and prompts
USER Specifies the name of the user ID for which the Apply program is started. When you run this command, you must be authorized (have *USE rights) to the specified user profile.

The Apply program runs under the specified user profile. The control tables (in ASN) are located on the relational database specified with the CTLSVR parameter. The same control tables are used regardless of the value specified on the USER parameter.

*CURRENT  (default) 
Specifies that the user ID associated with the current job is the user ID associated with this instance of the Apply program.

*JOBD
Represents the user ID specified in the job description associated with this instance of the Apply program. The job description cannot specify USER(*RQD).

user-name  (default) 
Specifies the user ID associated with this instance of the Apply program. The following IBM-supplied objects are not valid on this parameter: QDBSHR, QDFTOWN, QDOC, QLPAUTO, QLPINSTALL, QRJE, QSECOFR, QSPL, QSYS, or QTSTRQS.

When prompting on the STRDPRAPY command, you can press the F4 key to see a list of users who defined subscriptions.

JOBD Specifies the name of the job description to use when submitting the Apply program.

*LIBL/QZSNDPR  (default) 
Specifies the default job description provided with DB2 DataPropagator for AS/400.

library-name/job-description-name
Represents the name of the job description used for the Apply program.
DPRVSN Specifies the version of the Apply program to start.

7  (default) 
Start Version 7 of the Apply program.

5
Start Version 5 of the Apply program.
APYQUAL Specifies that an Apply qualifier be used by an Apply program instance. All subscriptions that are grouped together with this Apply qualifier will be run by this Apply program instance.

*USER  (default) 
Specifies the user name on the USER parameter as the Apply qualifier.

apply_qualifier
Specifies the name used to group the subscriptions that are to be run by this Apply program instance. You can specify a maximum of 18 characters for the Apply qualifier name. This name follows the same naming conventions as an RDB name. The subscriptions to be run are identified by the records in the subscription set table with this value in the APPLY_QUAL column.

When prompting on the STRDPRAPY command, you can press the F4 key to see a list of Apply qualifier names with existing subscriptions.

CTLSVR Specifies the control server where the common control tables are located.

*LOCAL  (default) 
Specifies that the subscription control tables are located on the local relational database.

rdb-name
Represents the name of the relational database where the control tables are located. You can use the Work with RDB Directory Entries (WRKRDBDIRE) command to find this name.

When prompting on the STRDPRAPY command, you can press the F4 key to see a list of available RDB names.

TRACE Specifies whether the Apply program should generate a trace. If the Apply program generates a trace, the trace is output to a spool file called QPZSNATRC.

*NONE  (default) 
Specifies that no trace is generated.

*ERROR
Specifies that the trace should contain information for errors only.

*ALL
Specifies that the trace should contain information for errors, execution flow, and SQL statements issued by the Apply program.

*PRF
Specifies that the trace should contain information that can be used to analyze performance at different stages of the Apply program execution.
FULLREFPGM Specifies whether the Apply program should invoke an exit routine to initialize a target table. When the Apply program determines that a target table needs to be full-refreshed, it invokes the specified exit routine rather than doing the full refresh itself.

When a full-refresh exit routine is used by the Apply program, the value of the ASNLOAD column in the Apply trail table is Y.

For examples and more information, see Refreshing target tables with the ASNLOAD exit routine for AS/400.

*NONE  (default) 
Specifies that a full-refresh exit routine is not used.

library-name/program-name
Represents the qualified name of the program that is called when the Apply program determines that it is necessary to do a full refresh of a target table. For example, to call program ASNLOAD in library DATAPROP, the qualified name is DATAPROP/ASNLOAD.
SUBNFYPGM Specifies whether the Apply program is to invoke an exit routine when it finishes processing a subscription set. Input to the exit routine consists of the set name, Apply qualifier, completion status, and statistics including the number of rejects.

The notify program allows you to examine the UOW table to determine the transactions that have been rejected and then allows you to take further actions such as issuing a message or generating an event.

For more information, see Using the ASNDONE exit routine for AS/400.

*NONE  (default) 
Specifies that an exit routine is not used.

library-name/program-name
Represents the qualified name of the program to be called when the Apply program completes processing a subscription set. For example, to call program APPLYDONE in library DATAPROP, the qualified name is DATAPROP/APPLYDONE.
INACTMSG Specifies whether the Apply program should generate a message whenever it completes its work and becomes inactive for a period of time.

*NO  (default) 
Specifies that no message is generated.

*YES
Specifies that the Apply program generate message ASN1044 before beginning a period of inactivity. Message ASN1044 indicates how long the Apply program will be inactive.
ALWINACT Specifies whether the Apply program is able to run in an inactive state (sleep).

*YES  (default) 
Specifies that the Apply program should sleep if there is nothing to process.

*NO
Specifies that if the Apply program has nothing to process, the job started for the Apply program should end.
DELAY Specifies the delay time (in seconds) at the end of each Apply program cycle when continuous replication is used.

6
Specifies a delay time of 6 seconds.

delay-time
Specifies a delay time between 0 and 6 seconds inclusive.
RTYWAIT Specifies in seconds how long the Apply program should wait after it encounters an error before it retries the operation that failed.

300
Specifies a retry wait time of 300 seconds.

retry-wait-time
Specifies a retry wait time between 0 and 35000000 seconds inclusive.

You can set up the system to automatically start the subsystem by adding the command that is referred to in the QSTRUPPGM value on your system. If you will use the QDPR/QZSNDPR subsystem, it will be started as part of the STRDPRAPY command processing.

If the relational database (RDB) specified with the CTLSVR parameter is a DB2 UDB for AS/400 database, the tables on the server are found in the ASN library. If the RDB is not a DB2 UDB for AS/400 database, you can access the tables using ASN as the qualifier.

Error conditions when starting the Apply program

The STRDPRAPY command issues an error message if any of the following conditions occur:

An Apply instance must be started for each unique Apply qualifier in every subscription set table. You can start multiple Apply processes by specifying a different Apply qualifier each time that you issue the STRDPRAPY command. These Apply processes will run under the same user profile.

Identifying Apply program jobs

Each Apply process is identified using both the Apply qualifier and the control server names. When run, the job started for the Apply process does not have sufficient external attributes to correctly identify which Apply process is associated with a particular Apply qualifier and control server combination. Therefore, the job is identified in the following way:

In general, you can identify the correct Apply program job by looking at the list of jobs running in the QZSNDPR subsystem if both:

Scheduling Apply for AS/400

Use the ADDJOBSCDE command to start the Apply program at a specific time.

Stopping Apply for AS/400

The End DPR Apply (ENDDPRAPY) command ends an instance of the Apply program on the local system.

You should end the Apply program before any planned system down time. You might also want to end the Apply program during periods of peak system activity.

>>-ENDDPRAPY----+---------------------------+------------------->
                |        .-*CURRENT--.      |
                '-USER(--+-user-name-+---)--'
 
>-----+----------------------------+---+----------------------+->
      |          .-*CNTRLD--.      |   |          .-7--.      |
      '-OPTION(--+-*IMMED---+---)--'   '-DPRVSN(--+-5--+---)--'
 
>-----+------------------------------------+-------------------->
      |           .-*USER-----------.      |
      '-APYQUAL(--+-apply-qualifier-+---)--'
 
>-----+----------------------------+---------------------------><
      |          .-*LOCAL---.      |
      '-CTLSVR(--+-rdb-name-+---)--'
 

Table 23. ENDDPRAPY command parameter definitions for AS/400
Parameter Definition and prompts
USER This parameter is ignored unless the APYQUAL parameter has a value of *USER, in which case this is the Apply qualifier associated with the instance of Apply.

*CURRENT  (default) 
Specifies the Apply process of the user associated with the current job.

user-name
Specifies the Apply process of the specified user.

When prompting on the ENDDPRAPY command you can press the F4 key to see a list of users who defined subscriptions.

OPTION Specifies how to end the Apply process.

*CNTRLD  (default) 
Specifies that the Apply process complete all of its tasks before ending. These tasks might take a considerable period of time if the Apply program is completing a subscription.

*IMMED
Specifies that the Apply program complete all of its tasks with the ENDJOB OPTION(*IMMED) command. The tasks end immediately, without any cleanup. Use this option only after a controlled end is unsuccessful, because it can cause undesirable results. (Unless the Apply program was asleep when you issued the ENDDPRAPY command, you should verify the target table contents.)

If the Apply program was performing a full refresh to the target table, the target table might be empty as a result of ending the Apply program before the table was refreshed with the source table contents. If the target table is empty, you must force a full refresh for this replication target.

You might find that a subscription is considered IN USE (the STATUS column in the subscription set table has a value of 1). If it is, reset the value to 0 or -1. This allows the subscription to be run again by the Apply program.

DPRVSN Specifies the version of the Apply program to end.

7  (default) 
Specifies Version 7 of the Apply program.

5
Specifies Version 5 of the Apply program.
APYQUAL Specifies the Apply qualifier used by an instance of the Apply program. All subscriptions that are grouped together with this Apply qualifier are run by the instance.

*USER  (default) 
Specifies that the user name specified on the USER parameter is the Apply qualifier.

apply_qualifier
Specifies the name used to group the subscriptions that this Apply instance runs. You can specify a maximum of 18 characters for the Apply qualifier name. This name follows the same naming conventions as an RDB name. You identify the subscriptions being run by the records in the subscription set table with this value in the APPLY_QUAL column.

When prompting on the ENDDPRAPY command, you can press the F4 key to see a list of Apply qualifier names with existing subscriptions.

CTLSVR Specifies the name of the relational database where the Version 7 control tables are located.

*LOCAL  (default) 
Specifies that the control tables are located on the local relational database.

rdb-name
Specifies that the subscription control tables are located on this relational database. You can use the Work with RDB Directory Entries (WRKRDBDIRE) command to find this name.

When prompting on the ENDDPRAPY command, you can press the F4 key to choose from the list of databases in the RDB directory.

The ENDDPRAPY command uses the value of the APYQUAL and CTLSVR parameters to search the Apply job table for the job name, job number, and job user for the referenced Apply program, and ends that job.

ENDDPRAPY issues an error message if the following conditions occur:


Additional Apply program operations

This section provides information about performing two additional Apply program functions: using the ASNDONE exit routine and refreshing target tables with the ASNLOAD exit routine.

Using the ASNDONE exit routine for AS/400

The ASNDONE exit routine is a program that the Apply program can optionally call after subscription processing completes, regardless of success or failure. A separate subscription notify program can be provided for each Apply qualifier. For general information about the ASNDONE exit routine, see Using the ASNDONE exit routine.

This section provides information about customizing the ASNDONE routine for an AS/400 environment.

When creating your subscription notify program, consider these activation group concerns:

If the program is created to run with a new activation group: the Apply program and the subscription notify program will not share SQL resources, such as RDB connections and open cursors. The activation handling code in the AS/400 operating system frees any resources allocated by the subscription notify program before control is returned to the Apply program. Additional resource is used every time that the Apply program calls the subscription notify program.

If the program is created to run in the caller's activation group: it shares SQL resources with the Apply program. Design the program so that you minimize its impact on the Apply program. For example, the program might cause unexpected Apply program processing if it changes the current relational database (RDB) connection.

If the program is created to run in a named activation group: it does not share resources with the Apply program. Using a named activation group will avoid the activation group overhead every time the subscription notify program is called. Run time data structures and SQL resources can be shared between invocations. Application cleanup processing is not performed until the Apply program is ended, so the subscription notify program must be designed to ensure that it does not cause lock contention with the Apply program by leaving source tables, target tables, or control tables locked when control is returned to the Apply program.

When you start the Apply program, specify the name of the subscription notify program using the parameter SUBNFYPGM on the STRDPRAPY command. For example, if the program is named ASNDONE_1 and resides in library APPLIB, use the command:

SUBNFYPGM(APPLIB/ASNDONE_1).

Refreshing target tables with the ASNLOAD exit routine for AS/400

The ASNLOAD full-refresh exit routine is called by the Apply program:

When a full refresh of a subscription set is necessary, the Apply program calls the exit routine. The program then performs a full refresh of the target table (if necessary), or of each target table listed in the subscription set.

You can use an exit routine instead of the Apply program to perform a full refresh more efficiently. For example, if you are copying every row and every column from a source table to a target table, you can design a full-refresh exit routine that uses a Distributed Data Management (DDM) file and the Copy File (CPYF) CL command to copy the entire file from the source table to the target table.

If the exit routine returns a non-zero return code, the current subscription set being processed by the Apply program fails. Processing of the remainder of the subscription set is discontinued until the next iteration.

Guidelines for using ASNLOAD

The source for sample exit routines is included with DB2 DataPropagator for AS/400. The samples for the C, COBOL, and RPG languages are:
Compiler language Library name Source file name Member name
C QDPR QCSRC ASNLOAD
COBOL QDPR QCBLLESRC ASNLOAD
RPG QDPR QRPGLESRC ASNLOAD

You cannot direct the Apply program to use another program unless you end the Apply program and start it again with another STRDPRAPY command.

If you plan to use ASNLOAD, be aware of the following items:

Required parameters for ASNLOAD

Return code
Specifies whether the exit routine was successful, indicated by a return code of 0. If the return code is not 0, the Apply program produces an error. If trace is on, the Apply program produces trace output.

Reason code
Specifies a value that can be used to further describe the exit routine failure. If the return code is not 0 and if trace is on, the Apply program includes the reason code information as part of the trace output. The values for the reason code should be specific to your user application.

Control server RDB name
Specifies the RDB name of the database where the subscription set tables are located. The name is padded with blanks.

Target server relational database (RDB) name
Specifies the name of the database where the target table is located. The name is padded with blanks.

Target table library
Specifies the name of the library that contains the target table. If the target server RDB name is not an AS/400 database, this parameter is the authorization ID of the target table, which is obtained from the TARGET_OWNER column of the row of the subscription member table that is currently processed by the Apply program. The name is padded with blanks.

Target table name
Specifies the name of the target table, which is obtained from the TARGET_TABLE column of the row in the subscription-targets-member table that is currently processed by the Apply program. If the target server is a database for AS/400, the name can be either an SQL table name or an AS/400 system file name. The name is padded with blanks.

Apply qualifier
Specifies the qualifier used to start this instance of the Apply program. This value is obtained from the APPLY_QUAL column of the row in the subscription set table that is currently processed by the Apply program. The name is padded with blanks.

Subscription set name
Specifies the name of the subscription set that the Apply program has just completed. This value is obtained from the SET_NAME column of the row in the subscription set table that is currently processed by the Apply program. The name is padded with blanks.

Source server RDB name
Specifies the RDB name of the database where the source table is located. The name is padded with blanks.

SQL SELECT statement
Specifies a variable-length SQL statement that you can use to select the source table rows and columns to be copied to the target table. The following table shows the structure of the SQL SELECT statement.
Offset (Hex or Decimal) Type Field
0 BINARY(4)
SQL statement length

4 Char(*)
SQL select statement

Trace indicator
Specifies whether the Apply program generates trace data. The exit routine can use the trace indicator to coordinate its internal trace with the Apply trace.

When the Apply program generates a trace, it prints to a spool file. If the exit routine is running in a separate activation group, the results print to a separate spool file. If the exit routine runs in the caller's activation group, the results print to the same spool file as the Apply trace.

The values for trace indicator are:

YES
Trace data is being produced.

NO
No trace data is being produced.

Other
No trace data is being produced.


[ Top of Page | Previous Page | Next Page ]