× 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.



> From: Barbara Morris
> 
> Joe, that's a good and standard technique, to use
> based(always_the_same_namee) for anything that's only to be used as a
> "type" definition.  The compiler won't allow __ as a name, though.
> 
> For the prefix, you might want to use the name of the structure, to
> avoid name collisions.

Thanks Steve, Scott and Barbara.  Since qualified won't compile back to
V4R5, I'm going to stick with the prefix for the short term.  However, I
need to make a decision on using the file name as the prefix, or a
generic prefix.  In my architecture, all database fields have unique
names.  Some people argue that if two fields share the same data, they
should have the same name, but in practice I've found that this
occasionally leads to unexpected results, since in RPG all database
fields are global.

Thus, since my names are all unique, I don't have to worry about
collisions between multiple reference structures, provided there is only
one structure per program.  I enforce that by having only one I/O module
per file.  All I/O is done through that module, and I would define the
reference DS in the same /COPY as the module's external prototypes.

Looking back on what I wrote, however, I see that by adding a
file-specific prefix I avoid any possible conflicts.  I still need to be
sure to only define the reference DS once, but that would be handled by
the "one I/O module per program".

Now, however, a new conflict comes into play.  In this situation, I have
a NON-I/O procedure that requires a field from a database.  Maybe it's a
formatting thing, or some other sort of business logic.  It doesn't
technically belong in the I/O module (for example, it may require fields
from multiple files).  If I were to use the technique as defined to this
point, I'd have conflicts if I had both the I/O module and the
formatting module in the same program.

So perhaps the idea is to use the MODULE name as the prefix.  That way,
I'd never have conflicts.

What do you think?

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.