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



RPG doesn't allow optional parameters to be specified before required
ones either.

Note the RPG offers omittable (*OMIT) and optional (*NOPASS) parameters.

C/C++ don't have the equivalent of an omittable param.  Or rather, all
C/C++ parms passed by reference could be (are by default) omittable.

When you pass *OMIT to an RPG IV procedure, what you are really doing is
passing a NULL pointer.

Thus, in your C/C++ program just make sure you pass a NULL pointer for
the *OMITted parameter.

HTH,

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
  

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx 
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Phil Kestenbaum
Sent: Wednesday, November 01, 2006 10:45 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Calling an RPG procedure with optional 
parameters from C code

Neither C nor C++ allows optional parameters to be specified before
required ones.  In C++, optional parameters can only be 
specified at the
end like this:

void func( int param1, int param2, int optional1 = 0, int 
optional2 = 0
)
{
   ...
}
I'm not familiar with the latest C standard, but I don't 
believe you can
overload a function like that in any version of C.

However, if you are really getting desperate, you could always use the
... operator the way functions like printf() & scanf() do.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Osborn, Stephen
Sent: Wednesday, November 01, 2006 8:25 AM
To: c400-l@xxxxxxxxxxxx; rpg400-l@xxxxxxxxxxxx
Subject: Calling an RPG procedure with optional parameters from C code

I have RPG procedures where the first two parameters are alternates,
i.e.
values must be supplied for 
param1, param3, param4, etc
or 
param2, param3, param4, etc

Using *OMIT I can call these in either mode from RPG, e.g.
callp procname(value1 : *OMIT : value3 : value4)
or 
callp procname(*OMIT : value2 : value3 : value4)

However I need to call some of these routines from some legacy C code.


How do I specify in C (both the prototype and the code) that param1 &
param2
can be *OMIT'd?


regards

Stephen Osborn
-- 
This is the RPG programming on the AS400 / 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.


This message contains information proprietary to our company. 
It is intended to be read only by the individual or entity 
named above or their designee.
Any distribution of this message or the information contained 
herein without written permission from our company is 
strictly prohibited. If the reader of this message is not the 
intended recipient or an agent responsible for delivering it 
to the intended recipient, you are hereby notified that you 
have received this document in error and that any review, 
dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail, and delete 
the original message.



-- 
This is the RPG programming on the AS400 / 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.




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.