Forcing ERROR from User Exit

 1 Replies
 1 Subscribed to this topic
 78 Subscribed to this forum
Sort:
Author
Messages
ArthurThum
Advanced Member
Posts: 25
Advanced Member

    I have an error condition that I would like the beginning USER EXIT to pass back to PA52. I am Setting CRT-ERROR-NBR = 106, CRT-ERROR-CAT ="PA52B", CRT-ERR-VAR1, CRT-ERR-VAR2

    When I animate the program, as soon as the user exit exits and returns to PA52, the error variables are reset and the error is not passed along.
    What do I need to code to force ANY error to appear?

    ArthurThum
    Advanced Member
    Posts: 25
    Advanced Member
      OK This post was out here for awhile and it was finally identified that that there was an error and this is what is happening.
      If you call a user exit you need to make sure that if your user exit contains nested procedures, you need to back out of all nested procedures before exiting the user exit.. What happened was this was not being done. When the code tried to exit, the user exit abended thereby wiping out all error messages and returns that were set up. The linkage section returning from the user exit gets reinitialized but there was no way to tell this is what was happening. so for example:
      ENTER USER EXIT ----PERFORM PROCEDURE A through A-END, this procedure PERFORM PROCEDURE B through B-END, this procedure PERFORM PROCEDURE C through C-END. You desire to exit because of some issue but instead of exiting immediately from within PROCEDURE C, you need to set a flag exit the PROCEDURE at C-END, then B-END and finally A-END which allows a smooth exit of the user exit back to the main procedure.
      Took awhile to find this one!