Skip to main content

 
IBM Power Systems software  >  IBM i  > Software  > 

IBM DB2 for i

  
OverviewKey BenefitsGetting StartedProductsSupport

DB2 Example: Add Remote
Journal ILE RPG source

H********************************************************
H* This program accepts input from a CMD to Add a Remote 
Journal.
H* /COPY is used to reduce the size of the source. 
Appropriate
H*  parts of the includes can also be copied directly to 
this source
H*  member.
H*********************************************************
H* Compile options
HDFTACTGRP(*NO) ACTGRP(*CALLER)
D*********************************************************
D* Includes for Journal APIs
D*
D/COPY QSYSINC/QRPGLESRC,QJOURNAL
D*********************************************************
D*
D*********************************************************
D* Error code parameter include. Bytes available is set to
        0 in *INZSR
D* which causes program to function check if any errors are
D* encountered. Error handling can be added to this 
        program by
D* changing the bytes available parameter to 16, or greater 
   than 16.
D* Changing this value without adding any error handling 
        to the
D* program will cause the program to appear to complete 
   normally
D* even when an error has occured, other than messages 
        logged to
D* the joblog.
D**********************************************************
D*
D**********************************************************
D* Standalone fields
D*
D/COPY QSYSINC/QRPGLESRC,QUSEC
D REQVARLEN       S            9B 0
D*                              Length of request variable
D REQFMTNAM       S            8A
D*                              Request format name
D***********************************************************
C***********************************************************
C* Main Line
C                   EXSR      ADDJRN
C                   MOVE      *ON           *INLR
C* End of Main Line
C**********************************************************
C**********************************************************
C* Program Initialization Subroutine
C*
C     *INZSR        BEGSR
C     *ENTRY        PLIST
C                   PARM           JRNNAME          20
C*                                  Journal Name
C                   PARM           RDBDIRE          18
C*                                  Remote Relational DB
C*                                    Directory Entry
C                   PARM               RMTJRNAME        20
C*                                  Remote Journal Name
C                   PARM               RJRNRLIB         10
C*                                  Remote Journal Receiver
C*                                     Library
C                   PARM            RMTJRNTYP         1
C*                                     Remote Journal Type
C*                                      1 = *TYPE1
C*                                      2 = *TYPE2
C                   PARM             MSGQNAME         20
C*                                      Message Queue Name
C                   PARM                DLTRCV            1
C*                                      Delete Receivers
C*                                      N = 0/Don't Delete
C*                                      Y = 1/Delete
C                   PARM                RMTJRNTXT        50
C*                                      Remote Journal Text
C                   EVAL      QUSBPRV = 0
C*                              See comments in D specs for
C*                               error code parameter.
C*
C                   ENDSR
C*************************************************************
C* Add Remote Journal Subroutine
C*
C     ADDJRN        BEGSR
C                   EVAL      REQVARLEN = %SIZE(QJOJ0100)
C                   EVAL      REQFMTNAM = 'ADRJ0100'
C     RMTJRNAME     IFNE      '*JRN'
C                   EVAL      QJOQRJN   = RMTJRNAME
C*                  Special value *JRN indicates remote
C               journal name is the same as the local
C               journal name. If this parameter = *JRN
C*              leave QJOQRJN blank. Otherwise set to
C*                 passed name.
C                   ENDIF
C     RJRNRLIB      IFNE     '*SRCSYS'
C                   EVAL     QJORJRLN  = RJRNRLIB
C*                    Special value *SRCSYS indicates 
C*              remote journal receiver library is the 
C*              same as the library on the source system. 
C*        If this parameter = *SRCSYS, leave 
C*              QJORJRLN blank. Otherwise set to passed name.
C*                           
C                   ENDIF
C                   EVAL      QJORJT    = RMTJRNTYP
C                   EVAL      QJOQJMQ   = MSGQNAME
C     DLTRCV        IFEQ      'Y'
C*                        Delete Receivers = Yes
C                   EVAL      QJODR     = '1'
C                   ENDIF
C     DLTRCV        IFEQ      'N'
C                   EVAL      QJODR     = '0'
C*                        Delete Receivers = No
C                   ENDIF
C                   EVAL      QJOTEXT   = RMTJRNTXT
C                   CALLB     QJOARJ
C                   PARM                    JRNNAME
C                   PARM                    RDBDIRE
C                   PARM                    QJOJ0100
C                   PARM                    REQVARLEN
C                   PARM                    REQFMTNAM
C                   PARM                    QUSEC
C                   ENDSR
C***************************************************************