|
RPG doesn't allow optional parameters to be specified before required ones either.
That is true for *NOPASS but not for *OMIT
When you pass *OMIT to an RPG IV procedure, what you are really doing is passing a NULL pointer.
I am not sure that is true. In the called procedure you test the field's address for NULL, not its value.
Thus, in your C/C++ program just make sure you pass a NULL pointer for the *OMITted parameter.
I tried that, before I asked a question here, and it didn't work. The procedure prototype said that an INT is being passed as the first parameter and when I specified a NULL there the module would not compile. However I just changed the first parameter of the procedure prototype to be pointer to INT and now NULL is acceptable and it is now working. As RPG, by default, uses pass by reference, in a C procedure prototype the declarations should be of type 'pointer to xxx'. All the other fields in my C procedure prototype were 'pointer to xxx' so that one was probably just a typo. Thanks for your assistance. regards Stephen Osborn
-----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Wilt, Charles Sent: 01 November 2006 15:56 To: RPG programming on the AS400 / iSeries Subject: RE: Calling an RPG procedure with optional parameters from C code 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
As an Amazon Associate we earn from qualifying purchases.
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.