0 pts.
 problems with infsr(*PSSR) and callp
I have a program in which I specify infsr(*PSSR) on a file. This program uses the callp command to call another program which in turn uses the callp to call another program. In this third program, if an error occurs on an IO command on a file that is different than the one upon which I specified the infsr(*PSSR) in the first program, the error is passed back to the first program and is handled by the *PSSR. Why is my *PSSR handling errors for files other than the one I specified? Is there a way to have a *PSSR only handle errors for a given file?

Software/Hardware used:
ASKED: February 13, 2007  4:56 PM
UPDATED: January 1, 2010  10:36 PM

Answer Wiki:
Hi Joy The *PSSR subroutine handles is called whenever an exception occurs within your program, irrespective of the cause. The INFSR() keyword for the file allows you to define an exception handling subroutine that is to be executed whenever an exception error occurs for the file. Specifying INFSR(*PSSR) means that you want the "standard" *PSSR subroutine to handle the file exception which it would do by default - that's the reason why *PSSR is handling the exceptions for your other files. If you only want exceptions handled for the specific file then give the subroutine a name other than *PSSR, for example "FileErrSr" and assign that with INFSR(FileErrSr). However, you would still get the other file exceptions being handled by *PSSR (unless you removed it). If you wanted to keep your *PSSR and not have it handling errors for the other files then create an empty subroutine called something like "IgnoreFileErr" and assign INFSR(IgnoreFileErr) to those files. Hope it helps Jonathan
Last Wiki Answer Submitted:  February 14, 2007  12:09 pm  by  astradyne   370 pts.
All Answer Wiki Contributors:  astradyne   370 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

One other thing (I really ought to reread before replying) is that you can specify the (e) extender on the CallP operation to have the error caught when you return to your program.

That would stop the *PSSR handling the error generated by the sub-procedure.

Jonathan

 370 pts.

 

Just in case, it should be clarified that CALLP can be used for calling programs or procedures. Verify whether the prototype has EXTPGM() or EXTPROC(). The default error handling process may be affected.

If the other programs were created by first compiling a module and then running CRTPGM, the *MODULE object can be part of the overall program. An external program call might not actually be happening.

Tom

 108,135 pts.