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



Makes perfect sense. Thanks for the information.

 
____________________________________
Gregory Schmidtberger
AVP - Consultant - Application Programming
Foreclosure & QC Technology
 
E-Mail        gregory.schmidtberger@xxxxxxxxxxxxxxxxx
Blackberry 785-393-7297
Alternate 818-207-6194
____________________________________


-----Original Message-----
From: Scott Klement [mailto:rpg400-l@xxxxxxxxxxxxxxxx]
Sent: Thursday, March 15, 2012 1:22 PM
To: RPG programming on the IBM i / System i
Cc: Schmidtberger, Gregory P
Subject: Re: ILE Exporting Variables and *DUPVAR

Hi Gregory,

I believe *DUPVAR will give you whichever data structure is the *first* one it finds when binding.

You seem to be expecting that if you give the data structures the same name, they'll all be "the same structure", and therefore will be shared across all modules. This is not the case. They are all separate structures.

Personally, I do not like exporting variables (including data
structures) from modules. I consider this to be a bad practice, and if someone in my shop does it, I'll put a stop to it, and get very cranky with that programmer. Instead, I recommend calling procedures to set/retrieve values. That way, there's a well-defined interface to these parameters, and it's very easy to follow the chain of logic to access them.

But, if you wanted to solve this problem while still importing/exporting variables, the easiest solution would be to give a unique name to each module's data structure. Personally, I would prefix the data structure name with the module name, so you'd have:

MODULE1_structureName
MODULE2_structureName
etc

Not only does eliminate the ambiguity of the name, but it makes it crystal clear to whomever is reading your code which module's data they are referring to.

IMHO, anything exported from a module should be prefixed like this, including subprocedures. And, as mentioned above, I would prefer procedures instead of the data structures.

On 3/15/2012 12:58 PM, Schmidtberger, Gregory P wrote:

I have several modules compiled into a service program. They each
control inserts/updates/and deletes to specific tables. And all these
modules export a data structure with exactly the same name. Because
they all export a data structure with the same name I have compiled
the service program with *DUPVAR. This service program is like a
database service. And then I have an RPGLE program that binds to this
service program and uses the exported sub procedures from those
modules for database updates. This RPGLE program also IMPORTS the data
structure being exported by the modules. All are compiled and bound
correctly so it appears. When I tested this with a single module I was
able to get to the imported data in that data structure.
But I'm having a problem. Now that I have several modules compiled the
imported data structure is always coming back to the RPGLE program
empty. I would like to keep a single name for the exported data
structure so that my upstream programs can always

count on importing a single data structure. Does anyone know if what
I'm attempting to do should work or not? Or is the fact that all the
modules exporting the same data structure name is causing a problem?
Thanks.


----------------------------------------------------------------------
This message w/attachments (message) is intended solely for the use of the intended recipient(s) and may contain information that is privileged, confidential or proprietary. If you are not an intended recipient, please notify the sender, and then please delete and destroy all copies and attachments, and be advised that any review or dissemination of, or the taking of any action in reliance on, the information contained in or attached to this message is prohibited.
Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Sender. Subject to applicable law, Sender may intercept, monitor, review and retain e-communications (EC) traveling through its networks/systems and may produce any such EC to regulators, law enforcement, in litigation and as required by law.
The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or free of errors or viruses.

References to "Sender" are references to any subsidiary of Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Attachments that are part of this EC may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link:
http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you consent to the foregoing.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.