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



Hi Vern,

I am aware that if you do not declare the pointer, then the compiler will do it for you.
I was trying to imply that one should not declare the pointer explicitly for a template.

-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Vern Hamberg
Envoyé : jeudi 24 septembre 2009 15:15
À : RPG programming on the IBM i / System i
Objet : Re: Problem with non QUALIFIED DS

David

A dummy pointer is often used - before v6r1 - to declare a
template variable or structure. It uses no memory, but it can
be used to define other data structures with LIKEDS - a very
handy thing. The basing pointer is also useful for data type
definitions similar to what C/C++ has. You then use the LIKE
keyword in your code.

Vern

David FOXWELL wrote:
Thanks Birgitta, I shall keep your example for future
reference. I find it a little hard reading pulling in 1
prototype at a time. Then again, the prototypes that caused
my problem were prototypes I didn't even need!

I have another question concerning the dummy pointer. It
seems I am the only one here that never declares that
pointer. It seems to me that if you declare it, you intend to
use it, and all the data structures based on it can then be
used. Is it unwise to declare the pointer for template based fields?


-----Message d'origine-----
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de
Birgitta Hauser

Hi,

I'm also using a data structure of the field reference
file and data
structures that are passed as parameters in my prototypes.
There is almost no field within my application that is not defined
with like or likeDS. Exceptions maybe indexes for looping through
arrays.
The data structures itself are (most times) in separate
copy members
and surrounded with compiler directives. These copy members are
included within my prototypes (nested copy members).
Also the names of the references start with REF (except my field
reference file which is simply named FldRef).
In this way I never have any problems except I have to use
qualified
data structures.

All prototypes are located in a source file named
QPROLESRC with the
same name as the source of the module or program All Copy
members for
data structures and Reference fields are located in a source file
named QCPYLESRC.

For example
Copy members for references
/If Not Defined (FldRef)
/Define (FldRef)
D FldRef E DS ExtName(DWFldRef)
Based(DummyPtr)
/EndIf

/If Not Defined (RefDSMyFile)
/Define (RefDSMyFile)
D RefDSMyFile E DS ExtName(MyFile) Based(DummyPtr)
/Endif

Prototype 1
/Include QCPYLESRC,FldRef
/Include QCPYLESRC,MyFile

/If Not Defined (MyProc)
/Define MyProc
D MyProc PR
D Parm1 Like(FldRef.MyField1) const
D Parm2 LikeDS(RefDSMyFile) Const
/Endif

/If Not Defined MyFct
/Define MyFct
D MyFkt PR Like(FldRef.MyFieldY)
D Parm1 Like(FldRef.MyFieldx) Const
/EndIf

Prototype 2
/Include QCPYLESRC,FldRef
/Include QCPYLESRC,MyFile2

/If Not Defined (MyProc2)
/Define MyProc2
D MyProc2 PR
D Parm1 Like(FldRef.MyFieldA) const
D Parm2 LikeDS(RefDSMyFile2) Const
/Endif

Program/Module

D/Include QPROLESRC,Proto1
D/Include QPROLESRC,Proto2

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

--
This is the RPG programming on the IBM i / System i
(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 ...

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.