- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have two modules, mod1 and mod2, and each has a procedure named Initialize. I would like to call the Initialize procedure from mod1 using the module name as a prefix; something like:
Call mod1::Initialize or Call mod1.Initialize
rather than just "Call Initialize"
But I can't find a syntax that the compiler likes. Is there a way to do this?
Thanks,
Steve
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you would make Initialize a CONTAINS procedure in the scope where it is called, that should accomplish it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can do it this way:
use mod1, mod1_initialize => initialize
use mod2, mod2_initialize => initialize
If initialize was a generic and took arguments of distinct types, you would not need to do this.
use mod1, mod1_initialize => initialize
use mod2, mod2_initialize => initialize
If initialize was a generic and took arguments of distinct types, you would not need to do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim,
Thanks for your response. Could you give me a little more info? What syntax would I use to call Initialize in mod1? I know "Call Initialize" will work, but I want to use the module name prefix. I've tried "Call mod1::Initialize" and other variations but all cause compile errors.
Thanks,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using a contained procedure wouldn't work - you can't have two different entities of the same name visible in a program unit. There is no qualifying syntax such as :: but renaming on the USE, as I showed, effectively accomplishes this. With this suggestion, you would call mod1_initialize and mod2_initialize.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve!
- Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page