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



David,

I would add a recommendation to what Joep said.

1. Change the name MyArray to MyArray_t or MyArrayTemplate (or something similar) this allows the next programmer that maintains this code to know at a glace that this is a template.

Duane Christen


--


Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx

Visit PAETEC.COM


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of J.Beckeringh@xxxxxxxxxxxxxxxxxxxxxxxxxx
Sent: Thursday, January 28, 2010 6:39 AM
To: RPG programming on the IBM i / System i
Subject: Re: Array DS as return variable

David,

The MyArray-defintion is not a declaration of a variable (well, strictly speaking you are defining pointer variable TEMPLATE); no storage is allocated for MyArray. With wArray you define a variable. To me a template data structure is a lot like a prototype; you might think of it as a prototype for a data structure. Whenever I use complex parameters in prototypes I include the templates in the same include member.

Joep Beckeringh



David FOXWELL

Hi,

I've coded my first array DS as a return variable as below. I'm
wondering if I've made a meal of it. I've added a definition of the
array immediately after the prototype so that callers will have this
definition. However I don't much like mixing the declaration of
variables and prototype.

Any suggestions?




D MyProc PR LIKE ( MyArray )
D DIM ( %ELEM ( MyArray ))

D MyArray S LIKE ( MyDefinition ) DIM ( 10 )
D BASED ( TEMPLATE )


P MyProc B
D PI LIKE ( MyArray )
D DIM ( %ELEM ( MyArray ))

D wArray S LIKE ( MyArray )
D DIM ( %ELEM ( MyArray ))

/FREE

RETURN wArray;

/END-FREE
--
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.