Re: Retrieve variable value
"Rich Hart" <[email protected]>
| Newsgroups | gmane.comp.lang.as400.mi |
|---|---|
| Message-ID | <003601c57c65$c8691c40$6401a8c0@server> |
Hi Peter, Not sure if I understood your question correctly, but I DOUBT there is any way to call any API which makes no distinction between ILE programs and OPM programs. The QTERTVPV API will do just what you want, but only for OPM programs (Cobol, RPG/3, MI, and CL) which are running in a job which is in debug mode (service mode lets you debug other jobs). It is fairly easy to call and works great, although I have only used it to retrieve variable information from MI programs. (for the others, there are the normal system debuggers, so why re-invent the wheel?). For ILE programs, the system debugger APIs should allow you to programmatically inspect variable information for ILE programs, but they are complex to use (I have no experience with it; again, not desiring to reinvent the wheel). On second thought, since you can debug OPM programs when in the ILE debugger IF the program had been compiled with the option SRCDBG(*YES), it may be that you could, in fact, get data from OPM programs this way too. A "simple" test will show whether it works. Another possibility is, seemingly (according to the documentation, if I read it correctly), the QteDumpModuleVariables API can be used to dump all the variables in a module, even if it is NOT in debug mode. Again, it may work only for ILE. Finally, Leif Svalgaard has an MI memory exploration program that may do what you want (documented in his E-book), but I have not gotten far enough yet in said book to know for sure. Anyway: good luck. In my opinion, QTERTVPV is the easiest way to implement what you want, with the restrictions of having to be in debug mode and OPM only. I don't see that MATACTAT (Materialize Activation Attributes) gives you the current value of variables in storage, only the activation attributes of OPM and ILE programs. You can also materialize the Object Definition Table with the MATPGM instruction, but again, my understanding is that you only get the DEFINITIONS of variables, not their values at run time. rich hart _______________________________________________ This is the MI Programming on the AS400 / iSeries (MI400) mailing list To post a message email: MI400-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/mi400 or email: MI400-request-Zwy7GipZuJhWk0Htik3J/[email protected] Before posting, please take a moment to review the archives at http://archive.midrange.com/mi400.