|
Steve Richter wrote: > > I dont follow the problem of fitting rpg exception handling in with the > whole OS/400 messaging protocol. > > Here is a way that the "Cee" APIs can be used to monitor for specific > message ids and either halt or promote those that are not monitored for. > ... > Is this not an acceptable way to handle exceptions in proc level rpg code? > ... Steve, using CEEHDLR can be dangerous if you handle the exception so that control returns to the next statement. The reason is that the next statement is not the next high-level-language statement - it's the next MI statement. This could take you back into the middle of the processing of your RPG statement and possibly cause data corruption. For example, say you are handling this statement: x = y + z where z is based, and you get a pointer-not-set exception for z. Your CEEHDLR handler handles the MCH3601 and control returns to the add statement and then on to the store to x. What does it add? Who knows. This is a made-up scenario - I have no idea how that particular scenario would work. But even if you established that it worked ok, it might not continue to work ok. The system doesn't guarantee upward compatible behaviour for the results of ignoring an exception. But besides that, the compiler might generate the code slightly differently even across PTFs which could cause the ignore-exception behaviour to change. (Exactly the same kind of problem can happen with RPG III programs that IGNDECERR. RPG III generates an ignore handler which causes the program to keep going with sometimes partially updated fields (!).)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.