Ken Sims wrote:
If I'm understanding the situation correctly, all of the program Bs
are not going to actually do anything with the information in the data
structure. They are just going to pass it along to the procedures in
service program C as a parameter.

That being said, you don't need to pass a pointer. As has already
been mentioned, parameters on dynamic program calls in RPG are already
using pointers. (So if you pass a pointer field, you are actually
passing a pointer to a pointer.)

In program A, use the data structure directly on calls to the program

In all of the program Bs, define it as just a one byte character
field. Pass the one byte field on the procedure calls to service
program C.

In service program C, define a data structure idential to the one in
program A. Make it based on a pointer. Set the pointer to the
address of the one byte field.

Why is that better than passing a pointer? Why say it's one byte field, when you're essentially using it the same way one would use a pointer? All that does is confuse the issue for maintenance programmers.

Another thought ... if the program Bs are going to call multiple
procedures in service program, and most/all of those procedures are
going to need the data in the data structure, you might want to

1. Making the data structure a global variable, based on a global
pointer field.
2. Creating a special procedure in service program C that would accept
the one byte character field and establish the pointer.

Then at the beginning of each program B, call the special procedure.
Doing this, you would not need to pass the one byte character on any
of the other procedures.

I think this is a good suggestion, but instead of having program B call the setup procedure, why not have program A call the setup procedure? Then program B doesn't need to have the data passed to it at all, though it might need to be passed some sort of handle that service program C can handle multiple "clients" simultaneously.

The article "Writing Reusable Service Programs"[1] by Scott Klement is worth a read if this design will be used. Actually, it's worth a read not matter what.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by 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.