×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
[SNIP]
1. What is SCOPE of myEventHandler and myErrorHandler??? I mean, can I
manipulate with Var1, Var2 ... VarN from MODUL A if subp implementation is
in ModulB
They're normal subprocedures that follow the same rules as any other
subprocedure. Aside from their own local variables, they can only use
global variables in the same module, unless they're passed as parameters
or IMPORTed from the activation group. Same as any other procedure.
2. If I can't acess VAR1, VAR2... VarN has anyone any IDEA how to make
them accessible??? EXPORT them (how can I do that???) or to define
USERSPACE that will hold neaded data and would be visible in MODULE B and
MODUL A???
Personally, I like to pass them as parameters. In an object-oriented
language, you'd typically have a bunch of variables that are part of the
class. To do the same thing in RPG, define a data structure for all of
these "class" variables, and pass it as a parameter to every procedure in
that "virtual class". Qualified data structures work really nicely for
this, because you can define them as templates in a /copy member, and use
LIKEDS to define them the same way everywhere (if that makes any sense.)
When working with call-backs, I also like to have an ordinary space
pointer that the calling procedure can pass to the service program, and
expect the service program to pass back to every call-back. That's really
useful because you can attach any data that you like, and have it
available in every callback procedure. Makes the service programs more
versatile.
3. If I want to write to PF named logPF in myEventHandler where should I
define that file in MODUL A or MODUL B??? (My Idea is that file is defined
in MODUL B so the interface could be more flexible)
Again, it's an ordinary subprocedure. The files must be defined in the
same module, as is always the case with any subprocedure in any RPG
program.
You could, of course, use the ILE C runtime library's _Ropen(), _Rreadn(),
etc functions if you needed a file that's shared across module boundaries.
4. Is there any literature/link/book/pdf which describes procedure
pointers more detailed than Sourcers guide???
There have been some magazine articles written, though I haven't read them
so I can't really make recommendations.
From my perspective, once you know you can get the address of a procedure,
and you can call a procedure at a given address, there's very little else
to say. The rest is the same as any other subprocedure call anywhere.
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.