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



On Mon, 10 Jan 2005 12:51:12 -0600, Dane Cox <DCox@xxxxxxxxxxxxx> wrote:
> Okay, let me see if I can reply to all of these in the same e-mail...but
> first a little more detail.  I thought I had enough, but apparently I am
> not using terminology the way that some others are...
> 
> The procedure is contained in a very simple 'nomain' module (compiled to
> *MODULE object) that is bound by copy to the RPGLE program (*PGM object)
> through the use of a binding directory.  The procedure explicitly opens
> and closes the file in question.  The RPGLE program that invokes the
> procedure does not use the file in question and there are no global
> variables with the same names as those in the file.  All RPGLE programs
> (*PGM objects) are compiled with the header spec (H actgrp('QILE')).
> 
> Now, I am certainly not saying that the way this is coded is the most
> correct.  I am simply trying to understand the scope of variables in
> this situation.  I need input so I can either change the code and/or use
> different methodologies to prevent this type of thing from happening.
> 
> So, addressing them in the order in which they have come in...
> 
> 
> Steve R. - I don't believe this is an example of traditional or
> non-modular programming at all.  All of the variables and files in
> question are declared in the procedure (or in the case of the f specs,
> at the 'module' level since we still can't declare them within the PI).
> So, apparently this fact alone makes file fields global to an activation
> group?  This is the part that intrigues and confuses me.

your right Dane, and my opinions on what is good or bad programming
practice is focused on how we all code our rpg programs.  In your
case, if you are on v5r3 and use a local to the proc data struct on
the database reads and writes, then your code will be modular.  At
least as modular as RPG allows it in that the file cursor and file
open/close are global to all the procs in the module.  Even in v5r1
there are techniques that can be used to relatively easily isolate
your database data in local data structs.

I responded to your post because I thought it illustrated how global
variables, in this case the ones RPG uses by default, can cause
confusion.  Modular is much better!

-Steve

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.