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



Kurt

I don't remember the circumstances, and it may have been in an earlier release - I have run into the need to declare the pointer and/or to initialize the pointer explicitly with the %addr() function. The syntax you give below seems to work most of the time, however. As I say, I don't remember where I've had the problem. But leaving out one or both items resulted in an MCH3601.

Vern

Kurt Anderson wrote:
Despite the fact that I have used Based and pointers for a while now,
it's surprising (or scary) how much I've learned in this thread.

Whenever I had seen pointers used, this is how the D-specs generally
were:
d pMyArray s *
d MyArray s 10a based(pMyArray)

So whenever I read the help on Based, when it talked about creating a
basing pointer, I thought it meant it was creating a connection between
the variable (MyArray) and the pointer (pMyArray).

However, I now realize that using D-specs like that is redundant. It
really only needs to be done like this:
d MyArray s 10a based(pMyArray)

To add to my previous misunderstanding, I had thought "@" held special
meaning (don't allocate) for Based. Though I now see that "@" is a
valid character to begin a variable name with, so it's really no
different than using TEMPLATE as the pointer.

I apologize if I added confusion to others on this topic.

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Simon Coulter
Sent: Friday, February 13, 2009 1:34 PM
To: RPG programming on the IBM i / System i
Subject: Re: Declaring the same DS in caller and callee


On 14/02/2009, at 3:35 AM, Kurt Anderson wrote:

I wish the help for the BASED keyword would mention
that implicit definition would occur when supplying a Based parameter
that is not defined elsewhere. (If it does exist somewhere, someone
please point it out to me.)


See the Chapter 15 of the ILE RPG Reference (any release supporting BASED):

"BASED(basing-pointer-name)
When the BASED keyword is specified for a data structure or stand- alone field, a basing pointer is created using the name specified as the keyword parameter."

Seems clear enough.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




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.