Could someone please help me with this?
1. I have an ever running job that calls a particular ILE program (PGM A) to do some XML parsing and composing.
2. PGM A calles another program PGM B (which in turn has modules MOD B, MOD C and a NOMAIN module MOD D binded to it).
3. PGM A parses the input XML and composes an output XML based on output generated in PGM B.
If everything goes fine, I guess we are OK. But I am concerned about what would happen if PGM B or one of the modules get an error. I need to handle this error and give back info back to PGM A so that I can compose Error Info on the Output XML.
Using Link List
1. Initially, I had plans to use Link Lists (because I wanted dynamic storage and not change array DS dimensions in future) to store output generated in PGM B. Then when I thought out "What if something goes wrong and I am not able to deallocate the memory allocated for the Link List", I hesitated a bit. It would have been easy if PGM B was on a separate activation group, but then I wouldn't be able to use Link list at all. But if I have everything on the same activation group, I can't use error handling features like Exit() function in C or the ILE API's because I believe they end everything upto the control boundary - it ended my job as well when I used it once while testing.
2. So, I took a copy of the source and used Array DS (although I don't prefer this one) instead of Link List. And put PGM B in a *NEW activation group.
- I am not sure if using *NEW is a good idea as I have heard it affects performance.
- So now PGM B is in a new activation group everytime it gets called. I coded C function Exit() to handle any uncaprtured errors - although it might really not be required since I guess the system will anyway release resources when the activation group ends.
My question here is: Is there any way I can have both PGM A and PGM B in the same activation group and use some API/ some logic that I could use to end normally (everytime) upto PGM B on an error (without having to use *NEW activation) and pass back control to PGM A to generate the Error XML. Its because I am not really sure with *NEW activation group affecting performance and that I would love to use dynamic link lists. I hate the idea of having to pass a Dimension 200 (I might need even more probably) array DS as parameter and in future having to increase it. Looks old fashioned and rigid to me.