Example: Set up journaling

The following are three examples of setting up journaling in the character-based interface. The first example sets up journaling with the both the journal and receiver in the system disk pool. The second and third examples set up journaling with the journal and journal receiver in separate basic disk pools.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
Related reference
Create Journal Receiver (CRTJRNRCV) command
Create Journal (CRTJRN) command

Journal and receiver in system disk pool

In this example, the library $DSTJRN is in the system disk pool and has the following description:

  • Type: PROD
  • Disk pool of library: 1
  • Create authority: *EXCLUDE
  1. The $DSTJRN library already exists in the system disk pool.
  2. The Create Journal Receiver (CRTJRNRCV) command creates journal receiver RCVDST1 in the $DSTJRN library:
    CRTJRNRCV JRNRCV($DSTJRN/RCVDST1) THRESHOLD(1500000)
              TEXT('RECEIVER FOR $DSTJRN JOURNAL')
  3. The journal receiver is placed in the system disk pool with the library because *LIBASP is the default value for the ASP parameter on the CRTJRNRCV command.
  4. Public authority for the journal receiver is *EXCLUDE because the Create authority value for the library is *EXCLUDE and the default for the authority (AUT) parameter is *LIBCRTAUT.
  5. The Create Journal (CRTJRN) command creates the associated local journal:
    CRTJRN JRN($DSTJRN/JRNLA) JRNRCV($DSTJRN/RCVDST1)
           MNGRCV(*USER)

Start of changeThe receiver size option is *MAXOPT2 and *RMVINTENT since the RCVSIZOPT(*SYSDFT) is the default for the CRTJRN command.End of change

Journal receiver in a nonlibrary basic disk pool

In this example, the journal receiver is in a nonlibrary basic disk pool and the journal is in the system disk pool.
  1. The CRTJRNRCV command creates journal receiver RCVDST2 in a nonlibrary basic disk pool
    CRTJRNRCV JRNRCV($DSTJRN/RCVDST2) THRESHOLD(1000000)
              ASP(2) TEXT('RECEIVER FOR $DSTJRN JOURNAL')
  2. The CRTJRN command creates the local journal in the system disk pool:
    CRTJRN JRN($DSTJRN/JRNLB) JRNRCVR($DSTJRN/RCVDST2)
           MSGQ($DSTJRN/JRNLBMSG)
               MNGRCV(*USER)
  3. When the receiver RCVDST2 exceeds 1 024 000 000 bytes of storage, a message (CPF7099) is sent to the JRNLBMSG message queue in the $DSTJRN library.
  4. The objects to be journaled must also be in the system disk pool.

Journal and journal receiver in basic disk pools

In this example, the libraries ARLIBR and ARLIB are in basic library disk pools and have the following description:

ARLIBR

  • Type: PROD
  • Disk pool of library: 3
  • Create authority: *USE
  • Text description: A/R Receiver LIB

ARLIB

  • Type: PROD
  • Disk pool of library: 4
  • Create authority: *USE
  • Text description: A/R Receiver LIB
  1. The CRTJRNRCV command creates journal receiver RCVDST3 in the library basic disk pool
    CRTJRNRCV JRNRCV(ARLIBR/RCVDST3) THRESHOLD(1500000)
              TEXT('RECEIVER FOR ARJRN JOURNAL')
  2. Because public authority is not specified, the public authority is set to *USE (the Create authority value for the ARLIBR library).
  3. The CRTJRN command creates the local journal that is associated with the RCVDST3 journal receiver:
    CRTJRN JRN(ARLIB/ARJRN) JRNRCV(ARLIBR/RCVDST3)

    When the RCVDST3 journal receiver exceeds 1 536 000 000 bytes of storage, the system creates a new journal receiver named RCVDST4, attaches it to the journal, and sends message CPF7020 (journal receiver detached) to the QSYSOPR message queue (the default queue).

  4. All objects journaled to the ARJRN journal must be in ASP 4 because the journal is in ASP 4.
  5. In this case, the database files and journal are in the same library. The journal receivers are in a library that is saved and restored after the journal library if a single command is used, because ARLIBR comes after ARLIB in a normal sort sequence.