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



This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
I'm curious what your reasons are for doing this?  Are you going to be
converting all your programs or just some?

Dave

-----Original Message-----
From: bmorris@ca.ibm.com [mailto:bmorris@ca.ibm.com]
Sent: Wednesday, February 20, 2002 11:35 AM
To: rpg400-l@midrange.com
Subject: Re: Trigger parameter prototypes



>From: Smith, Nelson [mailto:NSmith@lincare.com]
>Sent: Tuesday, February 19, 2002 2:32 PM
>
>I'm having trouble converting my trigger programs over to using prototypes
>rather than a PLIST.
>
>How do you specify the first parameter for a trigger in a prototype?  If I
>use an asterisk for a pointer,  how do I define the datastructure to start
>at that pointer location?   Since the second parameter gives us the size
of
>the first parameter, can that be used to declare the size of the first
>parameter?

Nelson, declare the data structure as based, and set the basing pointer
to the address of the first parameter.

D trigBuf         ds             based(pTrigBuf)
D   ...
D   oldRcdOffset ...
D   ...
D   newRcdOffset ...

 * Declare the trigBufParm as 1a, to avoid any inadvertent
 * changing of it
D trigpgm         pi
D   trigBufParm            1a
D   trigBufLen            10i 0  const

c          eval      pTrigBuf = %addr(trigBufParm)

Within the structure for the first parameter, you should only be
declaring the first 80 or so bytes.  The record areas should be
declared separately as based data structures, and their basing
pointers should be set using the offsets in the first parameter.

D inRecord    e ds           based(pInRecord)
D                            extname(myfile) prefix(in)
D outRecord   e ds           based(pInRecord)
D                            extname(myfile) prefix(out)

c          eval      pInRecord = %addr(trigbuf) + oldRcdOffset
c          eval      pOutRecord = %addr(trigbuf) + newRcdOffset

In V5R1, you could declare the parameter as a data structure
directly:

D trigBufType   ds           qualified based(dummy)
D   subfields ...

D trigpgm       pi
D   trigBuf                  likeds(trigBufType)
D   triglen           10i 0  const

c          eval      pInRecord = %addr(trigbuf)
c                              + trigbuf.oldRcdOffset
c          eval      pOutRecord = %addr(trigbuf)
c                               + trigbuf.newRcdOffset

Barbara Morris

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
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 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.