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

How to compare spooled files

Search400.com member Phillip Smith provides his methond to compare spooled files

This method allows a user to compare two spooled files for differences. I found this very handy when needing to...

compare test runs from before an after I had made program changes to a particular program.

1. Create two physicals file in your library, as such:

 
CRTPF FILE(PHSLIB/PHSSPOOL1)                             
       RCDLEN(132)                                        
       TEXT('physical file for compared spooled file #1') 
       SIZE(*NOMAX) 
                                                          
CRTPF FILE(PHSLIB/PHSSPOOL2)                             
       RCDLEN(132)                                        
       TEXT('physical file for compared spooled file #2') 
       SIZE(*NOMAX)   

2. Copy the two spooled files you want to compare to the files created above.

 
CPYSPLF FILE(TBLD_SRCG)               
        TOFILE(PHSLIB/PHSSPOOL1)      
        JOB(046095/PHILLIP/TBLDRV_SUR)
        SPLNBR(1)   
 CPYSPLF FILE(TBLD_SRCG)               
        TOFILE(PHSLIB/PHSSPOOL2)      
        JOB(046250/PHILLIP/TBLDRV_SUR)
        SPLNBR(1)    

3. Now compare the two physical files as such. You can send the output to the screen immediately , or to a spooled file to look at. In this example, I am outputting to a spooled file. The results will give you the differences between the two.

 CMPPFM NEWFILE(PHSLIB/PHSSPOOL2)  
       OLDFILE(PHSLIB/PHSSPOOL1)  
       OLDMBR(*FIRST)             
       RPTTYPE(*CHANGE)           
       OUTPUT(*PRINT)     

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close