How to avoid NAT1310?

The Natural-Documentation of ON ERROR says:

and the Documentation of RETRY says:

That means: If a NAT3145 happens in a module with no ON ERROR-Block, Natural traces back all structure-levels. And if an ON-ERROR-Block is found in one of the calling programs, this one is taken for error handling. But there, I can’t do a RETRY, otherwise a NAT1310 occurs.

So my question is: How can I avoid this situation from the ON-ERROR’s point of view? Is it possible to code the following way:

ON ERROR
  IF *ERROR-NR = 3145
    IF this-block-is-found-by-back-tracing  /* <-- what to code here?
      WRITE 'Record is in hold! Try later!'
      ESCAPE ROUTINE /* or whatever
    ELSE
      INPUT 'Hit ENTR to retry'
      RETRY
    END-IF
  END-IF
END-ERROR

Maybe there’s something with IF *PROGRAM = ‘…’ or IF *LEVEL = … But I got no idea how to solve this.

I know, that it’s possible to give every module an ON-ERROR-Block to avoid a NAT1310. But that would be a real time-consuming job for me (we got > 10000 Modules).

Regards,

Matthias

USR2001N will give you detailed information about the last error. Only if level and program name match, you may issue a retry (this user exit will provide you with the missing system variables *error-program and *error-level):slight_smile:

Thanks! USR2001N is a quite simple and working solution. It’s a shame that I didn’t know this by myself. :oops: :wink:

The USR2001N-Parameter P_ERROR_PROGRAM delivers an alphanumeric 32-byte field. But I tested it and it seems, that it’s always filled with the short name of the module. This is important in case of subroutine-modules, which have a long and a short name… But P_ERROR_LEVEL should work anyway.