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



Thanks Barbara. I was out of office last week and not able to try it. I'll put your suggestion to work. Thanks

________________________________

From: c400-l-bounces+lim.hock-chai=usamobility.com@xxxxxxxxxxxx on behalf of Barbara Morris
Sent: Fri 5/23/2008 3:09 PM
To: C400-L@xxxxxxxxxxxx
Subject: Re: [C400-L] Prototype varying length field and *nopass



Lim Hock-Chai wrote:
I'm trying to create a c prototype for RPG procedure below. I'm not
sure how to do *nopass and varying length field. Can somebody help?

D logECD_STP3...
D pr 15 0
D piModuleName like(logReffldSVLOGPF.LGMODULE)
D const
D piLocationID like(logReffldSVLOGPF.LGLOCID)
D const
D piLogMessage like(logReffldSVLOGPF.LGMSG)
D const
D piByteRcv 10i 0
D options(*nopass :*omit) const
D piDataRcv 2048 varying
D options(*nopass :*omit) const


For the varying length field, you can use a struct:

typedef struct varying2048
{
unsigned short l;
char a[2048];
} varying2048_t;

In the C prototype, code ... to represent all the optional parameters.

To get %PARMS to work in the called procedure, you have to use #pragma
descriptor.

Something like this:

decimal(15,0) LOGECD_STP3
(const whatever *moduleName,
const whatever *locationId,
const whatever *logmessage,
...);
#pragma descriptor(void LOGECD_STP3(void, void, void));

I would code EXTPROC('logECD_STP3') in the RPG prototype, so the C
version could be logECD_STP3. You could also use #pragma map for the C
prototype.

--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.