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



Sorry... you're right I misread what you stated.


Bob Cozzi
Cozzi Consulting
www.rpgiv.com

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Joe Pluta
Sent: Tuesday, December 30, 2003 7:58 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Initialization of static variables

> From: Bob cozzi
> 
> Joe,
> Why on Earth would you call a module?
> That is the strangest design decision I have seen on this ILE
architecture
> (not your's specifically just in general).
> I mean if you have:
>   CALLP  'MYMODULE'

Um.  Who said I was calling a module, Bob?

Basically, I'm using procedures within a program with a MAIN.  These
procedures perform tasks that require the preservation of data between
calls (static data).  While I can do this using global variables, I'd
rather this data not be visible outside the scope of the procedure, thus
I'd like to use local variables.

So, the obvious choice is to use local static variables with an
initializer.

The problem is that I would like these variables reinitialized each time
the program is called, but they are not (even if the program is bound
with ACTGRP(*NEW)!).  Thus, I have to manually reinitialize the
variables.  And since the data is local to the procedure, I must call
the procedure to initialize the data.  To date, I have done this by
passing no parameters to the procedure.  (This of course only works if
the procedure normally requires parameters.)

I'm not sure where you got "calling a module" from, except maybe by
reading between the lines I quoted of Barbara's explanation.

Joe

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.