Home > AS/400 Tips > iSeries programmer tips > Get up to speed on the restore/display journal receiver command
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

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


Dennis Cote
12.04.2003
Rating: -4.50- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.



Code

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


  
  

Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
RPG iSeries programming
Enhancing RPG with external SQL stored procedures
Introduction to SQLRPGLE on IBM i: Making a report
Making the most of RPG data handling on IBM i
IBM i shop boosts online sales with RPG-based Web platform
Migrating from RPG to EGL on IBM i
Allow access to data from a stored procedure result set using COBOL or RPG
EGL Rich UI on IBM i: Do you Dojo?
Programming for the Web on the IBM i, what is possible
A taste of COMMON: ILE, IBM releases, Web applications and new products
Documenting nested program structures on the AS/400

iSeries ILE programming
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
How to use an embedded SQL statement and display the result in a subfile
Eight steps for creating program documentation using AS/400 utilities
Searching fields for values
Searching part of a name or address in AS/400
Top 10 programmer tips YTD
How to use the binder language to manage service programs -- Part 3: Examples and pitfalls
Top 10 programmer tips of 2005
Understanding the binder language on AS/400

iSeries CL programming
Taking advantage of CL advancements, starting with V5R3
Checking in on your IBM i authorization lists
Running PHP open source applications: NOBODY needs authority
Simplify the process of converting a spool file from iSeries into an Excel spreadsheet
CL program for daily backups
An automated CL method of moving a query from AS/400 to Excel
Changing user password expiration
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Advanced Job Scheduler help

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Report Program Generator  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts