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


From: 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

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

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,
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

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-2022 by 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.