ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Journalling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Journalling

    Dear All,

    Physical files are journalled. Here can someone advise how to read the Journal using CL. How to know what are the records are updated or deleted or inserted in file using Journal through the CL program.
    if it is repeated , I apologies for this .

    Regards,
    Ramesh

  • #2
    Re: Journalling

    If you know the range of journal receivers you can use this command ...

    Command ...
    Code:
                 CMD        PROMPT('Display Journal Receivers')          
                 PARM       KWD(RCVA) TYPE(*CHAR) LEN(10) MIN(1) +       
                              CHOICE(*CHAR) PROMPT('Start Receiver Name')
                 PARM       KWD(RCVZ) TYPE(*CHAR) LEN(10) MIN(1) +       
                              CHOICE(*CHAR) PROMPT('End Receiver Name')  
                 PARM       KWD(RCVL) TYPE(*CHAR) LEN(10) MIN(1) +       
                              CHOICE(*CHAR) PROMPT('Journal Receiver +   
                              Library')                                  
                 PARM       KWD(JRNN) TYPE(*CHAR) LEN(10) MIN(1) +       
                              CHOICE(*CHAR) PROMPT('Journal Name')       
                 PARM       KWD(JRNL) TYPE(*CHAR) LEN(10) MIN(1) +       
                              CHOICE(*CHAR) PROMPT('Journal Library')    
                 PARM       KWD(TGTF) TYPE(*CHAR) LEN(10) MIN(1) +       
                              CHOICE(*CHAR) PROMPT('==> File being +     
                              investigated')                             
                 PARM       KWD(TGTL) TYPE(*CHAR) LEN(10) MIN(1) +       
                              CHOICE('*CHAR') PROMPT('==> Library for +    
                              above File')                                 
                 PARM       KWD(OUTN) TYPE(*CHAR) LEN(10) MIN(1) +         
                              CHOICE(*CHAR) PROMPT('Outfile Name')         
                 PARM       KWD(OUTL) TYPE(*CHAR) LEN(10) MIN(1) +         
                              CHOICE(*CHAR) PROMPT('Outfile Library')      
                 PARM       KWD(REPADD) TYPE(*CHAR) LEN(10) RSTD(*YES) +   
                              DFT(*ADD) VALUES(*REPLACE *ADD) MIN(0) +     
                              CHOICE(*VALUES) PROMPT('Replace or Add to +  
                              outfile')
    To call this CLP ...
    Code:
                  PGM        PARM(&RCVA &RCVZ &RCVL &JRNN &JRNL &TGTF +               
                               &TGTL &OUTF &OUTL &REPADD)                             
                                                                                      
     DCL &rcva   *CHAR 10  /* Starting Journal Receiver name to be searched        */ 
     DCL &rcvz   *CHAR 10  /* Ending Journal Receiver name to be searched          */ 
     DCL &rcvl   *CHAR 10  /* Journal Receiver Library                             */ 
     DCL &jrnn   *CHAR 10  /* Journal name that the target file is journaled to    */ 
     DCL &jrnl   *CHAR 10  /* Library that the journal is in (ASP01JRN etc)        */ 
                                                                                      
     DCL &tgtf   *CHAR 10  /* Target file that is being journaled / investigated   */ 
     DCL &tgtl   *CHAR 10  /* Library that target file is in                       */ 
                                                                                      
     DCL &outf   *CHAR 10  /* Outfile to receive the extracted journal entries     */ 
     DCL &outl   *CHAR 10  /* Library where the outfile resides                    */ 
     DCL &repadd *CHAR 10  /* Outfile to receive the extracted journal entries     */ 
                 SBMJOB     CMD(DSPJRN JRN(&JRNL/&JRNN) +                    
                              FILE((&TGTL/&TGTF *ALL)) +                     
                              RCVRNG(&RCVL/&RCVA &RCVL/&RCVZ) +              
                              OUTPUT(*OUTFILE) OUTFILE(&OUTL/&OUTF) +        
                              OUTMBR(*FIRST &REPADD) ENTDTALEN(*CALC)) +     
                              JOB(&TGTF) JOBQ(SINGLE) JOBPTY(8) LOG(4 0 +    
                              *SECLVL) LOGCLPGM(*YES) HOLD(*YES)             
                 ENDPGM
    That will extract the data from the journal receivers and put it in the output file. You can then parse the outfile with CL or RPG to read the journal entries etc.

    NOTE: reading journals causes the disk arms on the journal receiver ASP to move back and forth which if done too many times at once in conjunction with database updates being written to the same receiver can result in performance issues.
    Greg Craill: "Life's hard - Get a helmet !!"

    Comment


    • #3
      Re: Journalling

      Thanks!
      If there is any updates in the file , then that data are captured in outfile in a field (recorded data). If it is Yes, then I need to map the field postion and write it another PF to see the updated , inserted records. Plz advise

      Comment


      • #4
        Re: Journalling

        So I don't recall the journal record types for update / insert / delete, but you could look it up OR just try it.

        Make a table, journal it, update a record, insert a record.....
        Then using the above command look at the table and see what code is for the update and delete.

        Problem solved.
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment


        • #5
          Re: Journalling

          bookmark this (note V5R3 link)

          Greg Craill: "Life's hard - Get a helmet !!"

          Comment


          • #6
            Re: Journalling

            Thanks for the reply!
            I have 100 millions records in my file. If I run the command DSPJRN whether there will be any system performance. Currently I dont have access to the system(live).
            Could you please advise what is RISK if I use this command ?

            Comment


            • #7
              Re: Journalling

              There is no way in hell that you need the journal records for the entire file. DspJrn has a from and to date parm. Chunk down your requests into relevant bites.

              So yes, doing as dspjrn over a 100 mil file will raise many eyebrows as the system slows down.
              Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

              Comment

              Working...
              X