Implementing RRS for stored procedures during migration

To use some Db2 stored procedures, you must implement Resource Recovery Services (RRS). RRS is a sync point manager program that coordinates two-phase commit processing. Db2 requires that RRS be active because WLM-managed stored procedure address spaces use the RRS attachment facility (RRSAF).

About this task

RRS records events for protected resources in log streams that are managed by a z/OS® component called the system logger. The following table identifies the log streams that RRS uses, where gname can be your Sysplex name or any name in a non-Sysplex environment:

Table 1. Log streams that RRS uses
Log stream type Log stream name Content
Main unit-of-recovery log state stream ATR.gname.MAIN.UR The state of active units of recover (URs). RRS periodically moves this information into the RRS delayed UR state log when UR completion is delayed.
Delayed unit-of-recovery log state stream ATR.gname.DELAYED.UR The state of active URs, when UR completion is delayed.
Resource manager data log stream ATR.gname.RM.DATA Information about the resource managers that use RRS services.
Restart log stream ATR.gname.RESTART Information, which is needed during restart, about incomplete URs. This information enables a functioning RRS instance to assume remaining incomplete work from an RRS instance that failed.
Archive log stream ATR.gname.ARCHIVE Information about completed URs. This log stream is optional, but recommended.

All of these log streams are required except for the archive log stream. RRS does not start if it is not able to connect to the required log streams.

In a sysplex environment, these log streams are shared by the systems of the Sysplex.

Procedure

To implement RRS for stored procedures:

  1. Define the RRS log streams that are to be written, either on disk or in the coupling facility by completing the following actions:
    1. If you are using the coupling facility, add definitions for the RRS structures in the CFRM policy.

      When you are using coupling facility log streams, each log stream needs to be mapped to a coupling facility structure.

      The following example shows JCL that updates the CFRM policy to add the RRS structures:
      //DEFCFRM1 JOB MSGCLASS=X,TIME=10,MSGLEVEL=(1,1),NOTIFY=&SYSUID
      //STEP1 EXEC PGM=IXCMIAPU 
      //SYSPRINT DD SYSOUT=* 
      //SYSABEND DD SYSOUT=* 
      //SYSIN DD *
          DATA TYPE(CFRM) REPORT(YES)
          DEFINE POLICY NAME(CFRM18) REPLACE(YES)
          CF NAME(CF01)
              TYPE(009672)
              MFG(IBM)
              PLANT(02)
              SEQUENCE(000000040104)
              PARTITION(1)
              CPCID(00)
              DUMPSPACE(2048)
              CF NAME(CF02)
              TYPE(009672)
              MFG(IBM)
              PLANT(02)
      ................
      ................
      ................
      STRUCTURE NAME(RRS_ARCHIVE_1)
                     INITSIZE(8000)
                     SIZE(16000)
                     PREFLIST(CF1,CF2)
                     REBUILDPERCENT(5)
              STRUCTURE NAME(RRS_RMDATA_1)
                     INITSIZE(8000)
                     SIZE(16000)
                     PREFLIST(CF1,CF2)
                     REBUILDPERCENT(5)
              STRUCTURE NAME(RRS_MAINUR_1)
                     INITSIZE(8000)
                     SIZE(16000)
                     PREFLIST(CF1,CF2)
                     REBUILDPERCENT(5)
              STRUCTURE NAME(RRS_DELAYEDUR_1)
                     INITSIZE(8000)
                     SIZE(16000)
                     PREFLIST(CF1,CF2)
                     REBUILDPERCENT(5)
              STRUCTURE NAME(RRS_RESTART_1)
                     INITSIZE(8000)
                     SIZE(16000)
                     PREFLIST(CF1,CF2)
                     REBUILDPERCENT(5)
    2. Define the log streams in the system logger policy by using the IXCMIAPU utility. This utility program is provided in the SYS1.MIGLIB system library.

      If you are using the coupling facility, also define the structures in the system logger policy. You can map each log stream to a single structure or you can map log streams of like data types to the same structure.

      Example: Defining coupling facility log streams
      The following example JCL shows definitions for coupling facility structures and RRS log streams. In this case, each RRS log stream is mapped to a structure.
      //STEP1 EXEC PGM=IXCMIAPU
      //SYSPRINT DD SYSOUT=*
      //SYSIN DD *
      DATA TYPE(LOGR) REPORT(YES)
      
        DEFINE STRUCTURE NAME(RRS_ARCHIVE_1) LOGSNUM(1)
               MAXBUFSIZE(64000) AVGBUFSIZE(262)
      
        DEFINE STRUCTURE NAME(RRS_RMDATA_1) LOGSNUM(1)
               MAXBUFSIZE(1024) AVGBUFSIZE(252)
      
        DEFINE STRUCTURE NAME(RRS_MAINUR_1) LOGSNUM(1)
               MAXBUFSIZE(64000) AVGBUFSIZE(158)
      
        DEFINE STRUCTURE NAME(RRS_DELAYEDUR_1) LOGSNUM(1)
               MAXBUFSIZE(64000) AVGBUFSIZE(158)
      
        DEFINE STRUCTURE NAME(RRS_RESTART_1) LOGSNUM(1)
               MAXBUFSIZE(64000) AVGBUFSIZE(158)
      
      DEFINE LOGSTREAM
      NAME(ATR.SANDBOX.ARCHIVE) STRUCTNAME(RRS_ARCHIVE_1)
      LS_DATACLAS(SHARE33)
      HLQ(LOGR) MODEL(NO) LS_SIZE(1024)
      LOWOFFLOAD(0) HIGHOFFLOAD(80) STG_DUPLEX(NO)
      RETPD(15) AUTODELETE(YES)
      
      DEFINE LOGSTREAM
      NAME(ATR.SANDBOX.RM.DATA) STRUCTNAME(RRS_RMDATA_1)
      LS_DATACLAS(SHARE33)
      HLQ(LOGR) MODEL(NO) LS_SIZE(1024)
      LOWOFFLOAD(0) HIGHOFFLOAD(80) STG_DUPLEX(NO)
      RETPD(15) AUTODELETE(YES)
      
      DEFINE LOGSTREAM
      NAME(ATR.SANDBOX.MAIN.UR) STRUCTNAME(RRS_MAINUR_1)
      LS_DATACLAS(SHARE33)
      HLQ(LOGR) MODEL(NO) LS_SIZE(1024)
      LOWOFFLOAD(0) HIGHOFFLOAD(80) STG_DUPLEX(NO)
      RETPD(15) AUTODELETE(YES)
      
      DEFINE LOGSTREAM
      NAME(ATR.SANDBOX.DELAYED.UR) STRUCTNAME(RRS_DELAYEDUR_1)
      LS_DATACLAS(SHARE33)
      HLQ(LOGR) MODEL(NO) LS_SIZE(1024)
      LOWOFFLOAD(0) HIGHOFFLOAD(80) STG_DUPLEX(NO)
      RETPD(15) AUTODELETE(YES)
      
      DEFINE LOGSTREAM
      NAME(ATR.SANDBOX.RESTART) STRUCTNAME(RRS_RESTART_1)
      LS_DATACLAS(SHARE33)
      HLQ(LOGR) MODEL(NO) LS_SIZE(1024)
      LOWOFFLOAD(0) HIGHOFFLOAD(80) STG_DUPLEX(NO)
      RETPD(15) AUTODELETE(YES)
      /*
      Example: Defining disk log streams
      The following example JCL shows definitions for RRS log streams on disk.
      /DEFSTREXECPGM=IXCMIAPU
      //SYSPRINT DDSYSOUT=A
      //SYSINDD *
         DATA TYPE(LOGR)
      
         DEFINE LOGSTREAM NAME(ATR.PLEX1.MAIN.UR)
            LOWOFFLOAD(60)
            HIGHOFFLOAD(80)
            DASDONLY(YES)
            HLQ(TEST)
            LS_SIZE(1024)
            LS_DATACLAS(VSAMLS)
            STG_SIZE(1024)
      
         DEFINE LOGSTREAM NAME(ATR.PLEX1.DELAYED.UR)
            LOWOFFLOAD(60)
            HIGHOFFLOAD(80)
            DASDONLY(YES)
            HLQ(TEST)
            LS_SIZE(960)
            LS_DATACLAS(VSAMLS)
            STG_SIZE(960)
      
        DEFINE LOGSTREAM NAME(ATR.PLEX1.ARCHIVE)
           LOWOFFLOAD(0)
           HIGHOFFLOAD(80)
           DASDONLY(YES)
           HLQ(TEST)
           LS_SIZE(960)
           LS_DATACLAS(VSAMLS)
           AUTODELETE(YES)
           RETPD(2)
           STG_SIZE(2000)
      
        DEFINE LOGSTREAM NAME(ATR.PLEX1.RM.DATA)
           LOWOFFLOAD(60)
           HIGHOFFLOAD(80)
           DASDONLY(YES)
           HLQ(TEST)
           LS_SIZE(192)
           LS_DATACLAS(VSAMLS)
           STG_SIZE(192)
      
        DEFINE LOGSTREAM NAME(ATR.PLEX1.RESTART)
           LOWOFFLOAD(60)
           HIGHOFFLOAD(80)
           DASDONLY(YES)
           HLQ(TEST)
           LS_SIZE(960)
           LS_DATACLAS(VSAMLS)
           STG_SIZE(960)
    3. If you are using coupling facility log streams, compile and link-edit the changed CFRM policy.
    4. If you are using coupling facility log streams, activate the updated CFRM policy in your Sysplex by using the following operator command:
      SETXCF START,POLICY,TYPE=CFRM,POLNAME=polname
  2. Establish the priority for RSS within the WLM policy.

    The RRS priority needs to be equal to or higher than the dispatching priority of Db2. You can use the SYSSTC service class for the RRS address space to achieve a higher dispatching priority.

  3. Move the ATRRRS procedure that is supplied by IBM® from SYS1.SAMPLIB to your SYS1.PROCLIB as member RRS, and make any necessary changes.
    This JCL procedure is used to start RRS.

    You can use a member name other than RRS, but the first four characters of this name must match the subsystem name that you specify in the IEFSSNxx member of SYS1.PARMLIB in the next step.

    The GNAME value in the procedure must match the gname that you specified when defining the log streams. The default value for gname at RRS startup is the Sysplex name.

    The following example shows a sample procedure to start RRS.
    //RRS   PROC GNAME='',CTMEM=''
    //RRS   EXEC PGM=ATRIMIKE,REGION=0M,TIME=NOLIMIT,
    //          PARM='GNAME=&GNAME CTMEM=&CTMEM' 
    // 
  4. Define RRS as a subsystem to z/OS by editing the active IEFSSNxx member of SYS1.PARMLIB to include the following entry:
    SUBSYS SUBNAME(RRS) /* RESOURCE RECOVERY SERVICES */
    The subsystem name can be RRS or any other name that you choose. However, the first four characters (or fewer characters if the name is shorter) must match the name of the JCL procedure to start RRS.
  5. Start RRS by using the following operator command:
    START RRS

    If you subsequently need to stop RRS, use one of the following operator commands:

    • SETRRS CANCEL
    • SETRRS SHUTDOWN

    If neither of these commands stops RRS, use the FORCE RRS,ARM command. In this command, RRS is the subsystem name that your installation assigned to RRS in PARMLIB member IEFSSNxx.