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



"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx> wrote on 10/05/2016 07:41:25
PM:
On 10/5/2016 3:15 PM, Barbara Morris wrote:
...
You could use a C module for your main procedure. A C main gets its
parameters as an array of pointers. You could use this C module as the
program-entry module for any program where you want the parameters as
an
array. You just have to name the RPG procedure RPGMAIN (or whatever
name
you use in the C module).
...
// RPG "main"
ctl-opt nomain;

dcl-proc RPGMAIN export;
dcl-pi *n;
argCount int(10) value;
argArr pointer dim(400) options(*varsize);
end-pi;
dcl-s i int(10);

for i = 1 to argCount;
if argArr(i) <> *null;
// do something
endif;
endfor;
end-proc;


I forgot to mention that you could also define a data structure with a
named pointer for each parameter, and base a variable of the required
type on each pointer. Then copy the passed pointers to that data
structure and process the pointers by name.

I follow what you're saying. But, the RPG compiler already has a
%parms() built-in similar to $argc. So, it sure would be a lot easier if
the RPG compiler provided a %parma() or %parmv() built-in to reference a
parameter list as a pointer array -- similar to $argv[].

Sincerely,

Dave Clark

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.