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



Dan,

It makes no difference how you declare your paranmeters -- parameters are
parameters. Whether by prototype or by the *ENTRY plist, you get pointers
to the storage for the parameters.

Now, how you declare those parameters defines how you deal with them in
your code.

Read the error messages in your compiler listing. You have not included
complete source for us to read, but somewhere in there you have defined
TrgBuffer and TrgBufferLen TWICE. Have you included the definition twice
somehow? Use the compiler listing, not RDi, to find the issue. Hunt them
down. Remove one of the definitions of each of those and your program
should compile fine. There's nothing wrong with what you're doing, but
what I think you are meaning to do is achieve some equivalence with the
second post you made (the plist version). You will not accomplish that
with your code, yet.

​In the plist version, you would address the subfields of the structure by
their name, like tbFileName, for example. If you have a large codebase
using the definition already, you'll not want to change it. In order to
accept the parameter structure AND refer to the subfields by their name,
without qualification, you'll BASE the TrgBuffer structure on the address
of the P1 parameter when using a prototype. Use the based( pointer_name )
keyword on the DS line and set that pointer to the address of the parameter
you were passed. I have no RDi here so bear with me:

d TrgBuffer ds based( TrgBuffer_ )
d subfields...

d PgmName pr extpgm(xxxxxx)
d p1 1a
d TrgBufferLen 10i 0

d PgmName pi
d p1 1a
d TrgBufferLen 10i 0

/free

TrgBuffer_ = %addr( p1 );

more code...

*inlr = *on;
return;

/end-free

​You can do the same with the TrgBufferLen if you need to.​

However, if you are starting out with new code, do it right. Define the
TrgBuffer as qualified data structure TEMPLATE definition. I usually put
"_t" on the end of my template names, like TrgBuffer_t. This allocates NO
STORAGE for the stucture (like a typedef in C). You declare other
structures to be like this one using the LIKEDS keyword. The caveat is
that this forces you to refer to subfield in a qualified format, like
P1.tbFileName and the like.

Your first parameter would be named TrgBuffer and would be declared
likeds(TrgBuffer_t).
The second parm could be simply TrgBufferLen as an integer, or you could
define TrgBufferLen_t as a TEMPLATE also but not necessary.

d TrgBuffer_t...
d ds qualified template
d subfileds blah blah blah


d PgmName pr extpgm( 'whatever' )
d TrgBuffer likeds( TrgBuffer_t )
d TrgBufferLen...
d 10i 0

d PgmName pi
d TrgBuffer likeds( TrgBuffer_t )
d TrgBufferLen...
d 10i 0

/free

if TrgBuffer.tbFileName = 'THATFILE';
doSomething();
endif;

/endif

Then you refer to subfields as TrgBuffer.tbFileName, TrgBuffer.tbRRN, etc.

Which flavor you like is up to you, I VASTLY prefer the qualified data
structure because I can have two of them in the same module and not step on
each other. Qualified data structures improved my productivity immensely.

Good luck

Stu






On Tue, Apr 5, 2016 at 3:02 PM, (WalzCraft) Jerry Forss <
JForss@xxxxxxxxxxxxx> wrote:

Dan,

This is what the top on my trigger pgms look like.

// Input Parameters
D Entry PR ExtPgm('TRGBASER')
D TrigData LikeDS(TrigHeader)
D TrigDataBuf 10i 0

D Entry PI
D TrigData LikeDS(TrigHeader)
D TrigDataBuf 10i 0


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dan
Sent: Tuesday, April 5, 2016 2:20 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: Re: *Entry Plist w/ data structure using prototype / procedure
interface

BTW, if I replace the prototype / procedure interface with:
c *entry plist
c parm TrgBuffer
c parm TrgBufferLen
... it compiles.

- Dan
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Subject to Change Notice:

WalzCraft reserves the right to improve designs, and to change
specifications without notice.

Confidentiality Notice:

This message and any attachments may contain confidential and privileged
information that is protected by law. The information contained herein is
transmitted for the sole use of the intended recipient(s) and should "only"
pertain to "WalzCraft" company matters. If you are not the intended
recipient or designated agent of the recipient of such information, you are
hereby notified that any use, dissemination, copying or retention of this
email or the information contained herein is strictly prohibited and may
subject you to penalties under federal and/or state law. If you received
this email in error, please notify the sender immediately and permanently
delete this email. Thank You;

WalzCraft PO Box 1748 La Crosse, WI. 54602-1748
www.walzcraft.com Phone... 608-781-6355
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.