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.