From: Rony G. F. <Ron...@wu...> - 2022-06-10 14:00:38
|
Hi Mike, On 6/10/2022 10:47 AM, hp...@we... wrote: ... cut ... > You advised to use BsfContextVariables() to set, get, or drop > variables of the _current_ variable pool. > Please define "current" ;) It is the context of the Rexx code executing BsfContextVariables(). ;) ... cut ... > In contrast to the varset stage, varload will filter by default > comments and blank lines before doing something like > >> loop forever >> line = Rexx peekto() /* readto() would do in this case */ >> parse line.upper sc +1 vn (sc) sv >> BSFContextVariables("Set", vn, sv) >> readto() >> end > > My question is, how does BSFContextVariables() "know" which pool > to use? There is no choice available to use any other pool than the context one, i.e. the variable pool of the location where your program runs BsfContextVariables(). (You could have a routine which collects the pipe results and returns it and at the receiver side issue the BsfContextVariables() with that data.) > From my point of view, there are several available in this > context: one of the stage involving BSFContextVariables(), another > one of ooRexx that started the NetRexx pipe, which itself could be > a method of a method of... and so on, resulting in several pools > within the same program/application. And does it make a difference > if BSFContextVariables() is called in a stage which was involved > by callpipe or addpipe? Then BSFContextVariables() will effect the Rexx context there. > Is that described or documented somewhere? TIA! Yes, BSFContextVariables() uses the ooRexx native API named "rexxapi.pdf", section "1.17. Rexx Interface Methods Listing", APIs named: DropContextVariable(), GetContextVariable() and SetContextVariable(). Just noticed that the context are "routine" and "exit", but not "method". --- Getting, setting and dropping variables without BsfContextVariable(): If you want to read the variables of the current context you could use the RexxContext object's variables method like this (cf. rexxref.pdf, section "5.4.16.12. variables"): do counter c with index idx item value over .context~variables say "#" c":" idx"="value end If you want to set variables (instead of interpret) you can use the value() BIF (built-in function) like this: call value hi, 'hi, my beloved world' say hi /* will say 'hi, my beloved world' If you want to drop variables use the DROP keyword statement like this: drop hi say hi /* will say 'HI' */ HTH, ---rony |