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

Audit file changes done by a program

Want to find out which records of the file have been changed by executing a program? Use the CMPPFM command to compare the old physical file against the new physical file.

If you want to find out which records of the file have been changed by executing a program, you can use CMPPFM (Compare Physical File Member) command to compare the old physical file against the new physical file. It will list all the records that have been changed -- inserted, deleted and changed (before change and after change). This can be very useful tool to test the program that updates files.

Do the following steps to audit file changes done by a program:

1. Backup the files that will be updated by the program, i.e. copy CUSTFILE to CUSTBKUP in your library.

2. Execute the program, i.e. CUS001 that will update the file e.g. CUSTFILE.

3. Use CMPPFM command to compare CUSTFILE against CUSTBKUP file:

CMPPFM NEWFILE(MYLIB/CUSTFILE) OLDFILE(MYLIB/CUSTBKUP) OUTPUT(*)

Above command will compare new file (updated) CUSTFILE against old file (backed up CUSTFILE) CUSTBKUP and display the result of changes on the screen.

There are various parameters such as OUTPUT can *,print or *outfile you can use to produce better audit. If you have packed data in file, you might want to use *outfile so that you can see packed data before and after.

You can press F10 to get additional parameters such as Process option to use *longlines to display upto 198 characters of changes.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close