Problem solve Get help with specific problems with your technologies, process and projects.

Displaying the contents of a journal

Display the contents of a journal to see what has changed in a file.

Have you ever tried to display the contents of a journal to see what has changed in a file (using DSPJRN) but couldn't work out which fields have changed?

Now you can by following these simple steps!


 
		
1.	Display the journal to an outfile, using the following command:

DSPJRN 	JRN(Library /Journal) FILE((Library / File)) ENTTYP(*RCD) OUTPUT(*OUTFILE) OUTFILFMT(*TYPE3)
		OUTFILE(QTEMP/QRY1) ENTDTALEN(*CALC)           

2.	Create a Query that will join the outfile (QRY1 in QTEMP) to the physical file whose journal contents you want to see.

	I.	Specify File Selections:

		File . . . . . . . . .   QRY1          
  Library  . . . . . .     QTEMP       
Member . . . . . . . .   *FIRST        
Format . . . . . . . .   QJORDJE3      
File ID  . . . . . . .   T01           
                                       
File . . . . . . . . .   File       
  Library  . . . . . .     Library  
Member . . . . . . . .   *FIRST        
Format . . . . . . . .   Format        
File ID  . . . . . . .   T02           

	II.	Specify Type of Join:

		Type of join . . . . . . . .   1    1=Matched records

		and chose a match that will never work:

		Field             Test     Field          
 		T01.JOENTL  _     EQ  _    T02.FIELDA___      

	III.	Select and Sequence Fields:

		Use F21 to select all, then deselect the last T01 field (T01.JOESD)

	IV.	Select Output Type and Output Form:

		Output type  . . . . . . . .   3    3=Database file

File . . . . . . . . .   QRY2         
  Library  . . . . . .     QTEMP      
Member . . . . . . . .   *FILE
	
	V.	Run the Query

3.	Copy the records from the outfile (QRY1) to the file created by the Query (QRY2) using the following command:

	CPYF 	FROMFILE(QRY1) TOFILE(QRY2) MBROPT(*ADD)
FMTOPT(*NOCHK)

4.	Now use another Query (or any other file utility) to display the changes, together with their field names. 

Dig Deeper on iSeries CL programming

SearchDataCenter

Close