Re: Retrieve variable value
"Rich Hart" <[email protected]>
| Newsgroups | gmane.comp.lang.as400.mi |
|---|---|
| Message-ID | <001101c57f94$81bd95a0$6401a8c0@server> |
To elaborate on what Gene said, i. e.: > RSLVDP will get the static variable value in another OPM invocation (if the > variable had EXT scope). It took me a while to figure out "EXT Scope". That is to say, you define any variables of interest in the "source program" (PROGRAM-A) as EXT variables, as: DCL DD AN-EXTERNAL-VARIABLE CHAR(1) EXT; This is like defining a variable in RPG as EXPORTed. Step (2) would be to execute the RSLVDP instruction in the program (PROGRAM-B) which is trying to inspect variables in PROGRAM-A, which gives you a resolved data pointer. Step (3) would be to set a based-on variable in PROGRAM-B to be based on the static storage in PROGRAM-A. That way, PROGRAM-B can print that variable, or display it, or whatever. Also you can CHANGE it in PROGRAM-B and it will be changed in PROGRAM-A as well. It doesn't work to base a variable on a data pointer. You base the variable in PROGRAM-B on a space pointer, as usual, and then set that space pointer to the data pointer's value: SetSppFp Space-Pointer, Data-Pointer; The based-on variable now has the value of the original variable in PROGRAM-A. You can also use the MATPTR instruction to "inspect" the resolved data pointer to see just what kind of variable it is that you are accessing (character, binary, etc.) So ... is all this kefuffle worth it? Oh well, at least we learned something! _______________________________________________ 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.