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



On 2014-07-02 08:47, Charles Wilt wrote:
... If you didn't have the *NOPASS, you could do
D parmData DS
D parm1
D parm2
D parm3
D parm4
<...>
D parm Overlay(parmData)
D Like(parm1) Dim(200)

But I'm not sure it will work with *NOPASS

You can't put parameters into a data structure like that. Unless you mean that program should be changed so that it only gets one parameter with 200 subfields instead of 200 parameters.

I would use a C module for the main procedure. C receives program parameters as an array of pointers, while RPG dereferences the pointers under the covers. The C procedure could pass the array of parameters to the RPG procedure. But the array would be an array of _pointers_, not varying-length strings.

Here's an example. This C module could be used as the main module for any program that needs to handle parameters as an array of pointers.

For my little example, I tested for parameter values of 'abc' rather than blanks, but the idea is the same.

C module with a main procedure:
void RPGMAIN(int argc, void *argv[]);
void main(int argc, void *argv[])
{
RPGMAIN(argc, argv);
}

RPG module with procedure RPGMAIN.
ctl-opt nomain;

dcl-proc rpgmain export;
dcl-pi *n;
numParms int(10) value;
parmArr pointer dim(201); // first pointer is pgm name
end-pi;

dcl-s i int(10);
dcl-s parm varchar(999) based(p);

for i = 2 to numParms;
p = parmArr(i);
if parm = 'abc';
dsply 'it is abc';
else;
else;
dsply 'it is not abc';
endif;
endfor;

end-proc;


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.