Get up to speed on the restore/display journal receiver command

The restore/display journal receiver command gives programmers the ability to optionally restore up to five journal receivers.

The restore/display journal receiver command gives programmers the ability to optionally restore up to five journal

receivers. The command will then display the receivers as a group (DSPJRN). The journaled physical file data will be copied to a file that splits up the data into the fields that exist in the physical file. The programmer can then view the data through a file editor or query. This command has saved our programmers a lot of debugging time. We are also able to quickly retrieve answers on how things got updated when our users are questioning if our systems are working right. The programmer can see the actual physical file date split up into the correct fields as well as he display journal fields that are added to the top of the file (i.e. user name, job name, program name, etc.) The following explains how to run the command:

Step 1. Submit the Restore/Display Journal command.

  • Submit the Restore/Display Journal Receivers command to run as a batch job. Do not run this command interactively. Enter the SBMJOB command from a command line and prompt it (F4). Enter the RSTDSPJRN command on the CMD parameter line and prompt that (F4). The format of the command is as follows:

    RSTDSPJRN &TapDrvName &StrRcvName &RstRcv2 &RstRcv3 &RstRcv4 &RstRcv5 &EndRcvName &JrnPF &CpyToFile

    (Underlined parameters = Blanks are not allowed in parameter.)
  • &TapDrvName – The CL program is set up so you can optionally restore the journal receivers from tape and will always run the "Display Journal Receivers" command. It can display journal receivers without restoring them. You must enter the tape drive name in this parameter if you want the program to restore receivers from tape. Otherwise, leave it blank.
  • &StrRcvName – Enter the starting receiver name that needs to be restored and/or displayed.
  • &RstRcv2, 3, 4, 5 – If, you are restoring journal receivers and you have more than one receiver to restore, then these parameters are the other receiver names that need to be restored. A total of five receivers can be restored at one time. If you don't have five receivers to restore, then fill in the front-end parameters first and leave the back-end parameters blank.
  • &EndRcvName – Enter the ending receiver name that you want the Display Journal Receivers range to end with. You must enter this parameter even if you have already entered the same receiver name in one of the "RstRcv" parameters.
  • &JrnPF – Enter the physical file you want the Display Journal Receiver command to extract data for.
  • &CpyToFile – When the Display Journal Receiver command runs, it writes its data to a physical file (*OUTFILE) called DSPJRNP. This file cannot be viewed as is and must be copied to a file that will consist of the system data fields as well as the "Journaled Physical File" fields. The file name is the same as the "Journaled Physical File" name with "Z" as the object type (i.e. the item master file is ITMMSTZ).
  • The RSTDSPJRN command executes CL program UP6000C. This CL program does the restoring and displaying of the journal receivers.

Step 2. View the data.

  • The data can be viewed using EZVIEW or DBU. The "Copy To File" will usually have a key that makes it easy to find records you are looking for. You can also create a query to print out the data.


The following are the fields that get added as part of the display journal process. You will need to copy the DDS of the file you are displaying to a new file. Add the fields below to the top of your new file. The new file is your &CopyToFile.

 
     A            JOENTL         5S 0
     A            JOSEQN        10S 0
     A            JOCODE         1A
     A            JOENTT         2A
     A            JODATE         6A
     A            JOTIME         6S 0
     A            JOJOB         10A
     A            JOUSER        10A
     A            JONBR          6S 0
     A            JOPGM         10A
     A            JOOBJ         10A
     A            JOLIB         10A
     A            JOMBR         10A
     A            JOCTRR        10S 0
     A            JOFLAG         1A
     A            JOCCID        10S 0
     A            JORES          8A
              


CMD        PROMPT('Restore/Display Journal')

             PARM       KWD(TAPDRVNAME) TYPE(*CHAR) LEN(10) +
                          RSTD(*YES) VALUES('TAP01' 'TAP02' +
                          '          ') MIN(0) FULL(*NO) +
                          PROMPT('Tape Drive Name')

             PARM       KWD(STRRCVNAME) TYPE(*CHAR) LEN(10) REL(*NE +
                          '          ') MIN(1) PROMPT('Start +
                          Receiver Name')

             PARM       KWD(RSTRCV2) TYPE(*CHAR) LEN(10) MIN(0) +
                          PROMPT('Restore Receiver #2')

             PARM       KWD(RSTRCV3) TYPE(*CHAR) LEN(10) MIN(0) +
                          PROMPT('Restore Receiver #3')

             PARM       KWD(RSTRCV4) TYPE(*CHAR) LEN(10) MIN(0) +
                          PROMPT('Restore Receiver #4')

             PARM       KWD(RSTRCV5) TYPE(*CHAR) LEN(10) MIN(0) +
                          PROMPT('Restore Receiver #5')

             PARM       KWD(ENDRCVNAME) TYPE(*CHAR) LEN(10) REL(*NE +
                          '          ') MIN(1) PROMPT('End +
                          Receiver Name')

             PARM       KWD(JRNPF) TYPE(*CHAR) LEN(10) REL(*NE +
                          '          ') MIN(1) PROMPT('Journaled +
                          Physical File')

             PARM       KWD(CPYTOFILE) TYPE(*CHAR) LEN(10) REL(*NE +
                          '          ') MIN(1) PROMPT('Copy To File')

PROGRAM UP6000C:

Note: LSCSAVLIB/LSCJRN is the name of the library and journal in which our journal receivers are kept. You will have to replace this with your library and journal names.

The DSPJRNP is the outfile that gets created as part of the DSPJRN command. This file has to exist before the command is run. You can create this file by running the DSPJRN command from a command line with DSPJRNP specified as the *outfile. Don't delete the file after creating it.

 

             PGM        PARM(&TAPDRV &RCV1 &RCV2 &RCV3 &RCV4 &RCV5 +
                          &LSTRCV &FILNAM &CPYFIL)

             DCL        VAR(&TAPDRV) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RCV1) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RCV2) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RCV3) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RCV4) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RCV5) TYPE(*CHAR) LEN(10)
             DCL        VAR(&LSTRCV) TYPE(*CHAR) LEN(10)
             DCL        VAR(&FILNAM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&CPYFIL) TYPE(*CHAR) LEN(10)

/* RESTORE JOURNAL RECEIVERS   */
/* BYPASS IF ONLY DISPLAYING JOURNAL RECEIVERS */

             IF         COND(&TAPDRV *NE ' ') THEN(DO)

             IF         COND(&RCV5 *NE ' ') THEN(DO)
             RSTOBJ     OBJ(&RCV1 &RCV2 &RCV3 &RCV4 &RCV5) +
                          SAVLIB(LSCSAVLIB) DEV(&TAPDRV) +
                          ENDOPT(*UNLOAD) RSTASP(1)
             GOTO       CMDLBL(DSPJRN)
             ENDDO

             IF         COND(&RCV4 *NE ' ') THEN(DO)
             RSTOBJ     OBJ(&RCV1 &RCV2 &RCV3 &RCV4 &RCV4) +
                          SAVLIB(LSCSAVLIB) DEV(&TAPDRV) +
                          ENDOPT(*UNLOAD) RSTASP(1)
             GOTO       CMDLBL(DSPJRN)
             ENDDO


             IF         COND(&RCV3 *NE ' ') THEN(DO)
             RSTOBJ     OBJ(&RCV1 &RCV2 &RCV3 &RCV3 &RCV3) +
                          SAVLIB(LSCSAVLIB) DEV(&TAPDRV) +
                          ENDOPT(*UNLOAD) RSTASP(1)
             GOTO       CMDLBL(DSPJRN)
             ENDDO

             IF         COND(&RCV2 *NE ' ') THEN(DO)
             RSTOBJ     OBJ(&RCV1 &RCV2 &RCV2 &RCV2 &RCV2) +
                          SAVLIB(LSCSAVLIB) DEV(&TAPDRV) +
                          ENDOPT(*UNLOAD) RSTASP(1)
             GOTO       CMDLBL(DSPJRN)
             ENDDO

             IF         COND(&RCV1 *NE ' ') THEN(DO)
             RSTOBJ     OBJ(&RCV1 &RCV1 &RCV1 &RCV1 &RCV1) +
                          SAVLIB(LSCSAVLIB) DEV(&TAPDRV) +
                          ENDOPT(*UNLOAD) RSTASP(1)
             GOTO       CMDLBL(DSPJRN)
             ENDDO

             ENDDO

/* DISPLAY JOURNAL             */

 DSPJRN:     DSPJRN     JRN(LSCSAVLIB/LSCJRN) FILE((*LIBL/&FILNAM)) +
                          RCVRNG(LSCSAVLIB/&RCV1 LSCSAVLIB/&LSTRCV) +
                          OUTPUT(*OUTFILE) OUTFILE(*LIBL/DSPJRNP) +
                          ENTDTALEN(1000)

/* COPY JOURNAL DATA           */

             CPYF       FROMFILE(*LIBL/DSPJRNP) +
                          TOFILE(*LIBL/&CPYFIL) MBROPT(*REPLACE) +
                            FMTOPT(*NOCHK)

             ENDPGM


  
  
This was first published in December 2003

Dig deeper on RPG iSeries programming

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close