I assume that you're doing this in the context of a menu program and you want to identify, after the comparison runs, whether or not there were any problems. Unfortunately, you can't easily get an error code that returns the results, but you can parse the listing file to identify whether or not there were errors. You can do this by counting the number of lines in the file and determining whether more than six lines of text are in the output file, in which case there were errors. The code might look like this:
PROC GLOBAL
file pffFile,listingFile;
alpha (300) filename1,filename2,
listingReport = ".\diffReport.lst",
str;
// PROC ...........
// write out the PFF file
setfile(pffFile,"compare.pff");
filewrite(pffFile,"[Run Information]");
filewrite(pffFile,"Version=CSPro 4.1");
filewrite(pffFile,"AppType=Compare");
filewrite(pffFile,"[Files]");
filewrite(pffFile,"Application=.\comparisonSpecs.cmp");
filewrite(pffFile,"Listing=%s",strip(listingReport));
filewrite(pffFile,"InputData=%s",strip(filename1));
filewrite(pffFile,"ReferenceData=%s",strip(filename2));
filewrite(pffFile,"[Parameters]");
filewrite(pffFile,"ViewListing=Never");
close(pffFile);
// run the PFF
execpff(filename(pffFile),wait);
// the listing report, if there were no differences, will only be six lines
setfile(listingFile,listingReport);
numeric numLinesRead;
while fileread(listingFile,str) and inc(numLinesRead) <= 6 do
enddo;
close(listingFile);
if numLinesRead > 6 then
// there were errors
else
// no errors
endif;