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



Rory, you're performing an OUT prior to the call, which is unlocking the
data area. Check this out:
"You can specify the optional reserved word *LOCK. When *LOCK is
specified, the data area remains locked after it is updated. When *LOCK
is not specified, the data area is unlocked after it is updated."

However I'm not so sure the called program can access that locked data
area.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rory Hewitt
Sent: Tuesday, January 13, 2009 2:33 PM
To: RPG programming on the IBM i / System i
Subject: Re: Passing unwanted parameters

Scott,

In fact, the RPG manual isn't quite correct...

From the "Data Area Operations" section at
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/b
ooks_web/c092508502.htm(
*my italics*):

"A data structure defined with a U in position
23<http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/books_web
/c0925085332.htm#HDRD23>of
the definition specifications indicates that the data structure is a
data
area. You may specify the DTAARA keyword for a data area data structure,
if
specified you can use the IN, OUT and UNLOCK operation codes to specify
further operations for the data area. *The data area is automatically
read
and locked at program initialization time, and the contents of the data
structure are written to the data area when the program ends with LR
on*. If
the data area for a data area data structure is not found, it will be
created with an initial value of blanks. If the library list was
searched
for the data area, the new data area will be created in QTEMP."

If you have the following definition in both caller and called:

D ExtraParm UDS 32 Dtaara(EXTRAPARM)

then the data area is created in QTEMP (if it doesn't exist) read and
locked
with *EXCLRD in the caller. In the called program, it's read, but it's
already locked. However, when the called program ends, the lock is
released!
So when control returns to the caller, the lock is gone...

To me this seems like a bug - surely the program which initially read it
and
obtained the lock (the caller) should keep the lock until *it's* ended?

Rory

p.s. My code:

CALLER:

D ExtraParm UDS 32 Dtaara(EXTRAPARM)
/free
ExtraParm = *all'abc';
out(e) ExtraParm;
callp test2();
dsply ExtraParm;
return;
/end-free

CALLED:

D ExtraParm UDS 32 Dtaara(EXTRAPARM)
/free
dsply ExtraParm;
ExtraParm = *all'def';
out(e) ExtraParm;
return;
/end-free

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.