IBM Support

How to Start Journaling for All Files in a Library

Troubleshooting


Problem

This document describes how you can start journaling all physical files in a library that are not already journaled.

Resolving The Problem

Use the STRJRNLIB command and set the inherit rules to start journaling on the objects you want when they are created, restored, or moved into the library after the STRJRNLIB was issued. It does not start journaling on objects that are already in the library. If you are unable to clear the library and restore, but would like all the objects to be journaled, you can do one of the following options:

Option 1:

Use the STRJRNPF or STRJRNOBJ commands with File or Object parm set to *ALL or a generic name. The command will ignore objects that are already journaled, and will continue the entire list of objects for that journal even if some of them fail.

STRJRNPF FILE(LIB/*ALL)
STRJRNOBJ OBJ(LIB/*ALL)

Option 2:

Use the below sample code to start journaling on objects you want to started.
 
Caution: This document contains code made available by IBM Corporation on an as is basis. IBM does not provide technical support for this document and will not be responsible for any consequences from using the program. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply the reliability, serviceability, or function of these programs. The implied warranties of merchantability and fitness for a particular purpose are expressly disclaimed.

This document provides code for a sample program to start journaling for all files in a library that are not already journaled. To run this program, after it is compiled, the following parameters must be passed in:
1. Library to look for physical files
2. Library of the journal
3. Journal name
4. Images parameter - *BOTH or *AFTER (refer to the STRJRNPF command parameter for details)
5. Omit parameter - *NONE or *OPNCLO (refer to the STRJRNPF command parameter for details)
Sample Call: CALL PGM(MYLIB/STRJRNLIB) PARM('MYLIB' 'MYLIB' 'MYJRN' '*BOTH' '*OPNCLO')

Note: To compile this program, the outfile must be created first. This can be done by typing the following on an operating system command line for any library:

DSPOBJD OBJ(MYLIB/*ALL) OBJTYPE(*FILE) OUTPUT(*OUTFILE) OUTFILE(QTEMP/FILELIST)

Press the Enter key.

Note: You must compile the program interactively or create the above outfile in a library other than QTEMP that is in the library list of the batch program doing the compile.

Code:
        *************** Beginning of data **************************************
0001.00              PGM        PARM(&LIBNAME &JRNLIB &JRNNAME &IMAGES &OMIT)  
0002.00              DCL        VAR(&LIBNAME) TYPE(*CHAR) LEN(10)              
0003.00              DCL        VAR(&JRNLIB) TYPE(*CHAR) LEN(10)                
0004.00              DCL        VAR(&JRNNAME) TYPE(*CHAR) LEN(10)              
0005.00              DCL        VAR(&IMAGES) TYPE(*CHAR) LEN(10)                
0006.00              DCL        VAR(&OMIT) TYPE(*CHAR) LEN(10)                  
0007.00              DCLF       FILE(QTEMP/FILELIST)                            
0008.00              MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(CLEANUP))      
0009.00                                                                        
0010.00  START:      DSPOBJD    OBJ(&LIBNAME/*ALL) OBJTYPE(*FILE) +            
0011.00                           OUTPUT(*OUTFILE) OUTFILE(QTEMP/FILELIST)      
0012.00                                                                        
0013.00  LOOP:       RCVF                                                      
0014.00              IF         COND((&ODOBTP *EQ '*FILE') *AND (&ODOBAT *EQ +  
0015.00                           'PF') *AND (&ODJRST *EQ '0')) THEN(GOTO +    
0016.00                           CMDLBL(STRJRN))                              
0017.00              ELSE       CMD(GOTO CMDLBL(LOOP))                          
0018.00                                                                        
0019.00  STRJRN:     STRJRNPF   FILE(&ODLBNM/&ODOBNM) JRN(&JRNLIB/&JRNNAME) +  
0020.00                           IMAGES(&IMAGES) OMTJRNE(&OMIT)            
0021.00              GOTO       CMDLBL(LOOP)                                
0022.00                                                                      
0023.00  CLEANUP:    DLTF       FILE(QTEMP/FILELIST)                        
0024.00              ENDPGM                                                  
        ****************** End of data **************************************

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CGIAA2","label":"IBM i Db2-\u003EJournal"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

378141238

Document Information

Modified date:
18 November 2024

UID

nas8N1015537