problems with infsr(*PSSR) and callp

Application development
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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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


Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • astradyne
    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 pointsBadges:
  • TomLiotta
    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
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: