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



As I mentioned earlier %Parms did seem to be returning 2 as expected. But this was in a test program shell I created for testing this issue.

I made the changes to the full blown version of the program and I'm back to %Parms returning zero.
Below is my source. I corrected prototype by specifying extpgm and added the default to the command.
Could this have anything to do with the program being SQLRPGLE?

The command source...
CMD PROMPT('SBT Workflow driver')
PARM KWD(DATE) TYPE(*CHAR) LEN(8) MIN(0) +
DFT(*CURRENT) PROMPT('Date to process +
(YYYYMMDD)')
PARM KWD(STORE) TYPE(*DEC) LEN(3 0) MIN(0) +
DFT(0) PROMPT('Store to process')

And the SQLRPGLE source....
d SB0010 pr extpgm('SB0010')
d 8a const
d 3p 0 const
d
d SB0010 pi
d dateToProcess 8a const
d storeToProcess...
d 3p 0 const

I'm pretty sure I'm missing something simple but I can't see it.

Thanks in advance,

Rob


On 10/15/2014 2:33 PM, Robert Rogerson wrote:
Thanks everyone,

I'll change my command to supply default values and the RPG to always expect 2 parameters. This does seem to work.

Scott, my bad, I forgot to code extpgm('SB0010') on the prototype. When I added the keyword %Parms started returning 2 as expected.

Thanks,

Rob
On 10/15/2014 2:18 PM, Scott Klement wrote:
Hi Robert,

Normally, a CL command will always pass all parameters defined. If the user doesn't supply a value for one of them, it'll either pass the default value, or a *NULL pointer. (like options(*omit))

Therefore, I don't understand why you'd get a %PARMS of 0. There must be something else going on here. You show the command, but then you show a subprocedure -- and of course, a CL command cannot call a subprocedure, so there must be some other piece of code in between -- that is likely to be where the error is occurring, causing %PARMS to be 0.

Can you tell us more about that?



On 10/15/2014 12:55 PM, Robert Rogerson wrote:
Hi all,

I have an RPGLE program with the prototype and interface coded as

d SB0010 pr
d 8a const options(*nopass)
d 3p 0 const options(*nopass)

d SB0010 pi
d dateToProcess 8a const options(*nopass)
d storeToProcess...
d 3p 0 const options(*nopass)

I created a command wrapper

CMD PROMPT('SBT Workflow driver')
PARM KWD(DATE) TYPE(*CHAR) LEN(8) MIN(0) +
PROMPT('Date to process +
(YYYYMMDD)')
PARM KWD(STORE) TYPE(*DEC) LEN(3) MIN(0) +
PROMPT('Store')

So I want to be able to call the program from the command in one of
three ways.

1. SB0010CMD (no parameters)
2. SB0010CMD DATE('20141015')
3. SB0010CMD DATE('20141015') STORE(25)

In the RPG program I have

Select;
When %Parms = 0;
fromStore = 1;
toStore = 999;
currentDate = %Date();
When %Parms = 1;
fromStore = 1;
toStore = 999;
currentDate = %Date(dateToProcess: *iso0);
When %Parms = 2;
fromStore = storeToProcess;
toStore = storeToProcess;
currentDate = %Date(dateToProcess: *iso0);
Other;
Return;
Endsl;

When I test this in debug no matter how I call it %Parms is always
zero. But I have noted that the first parameter (in debug) does have
the correct value although this may be a fluke.

I have a feeling that the issue is that the operational descriptor is
not being passed (I'm assuming this from what I've been able to find on
the internet). I didn't think this was going to be so difficult.

Am I over looking something very simple? If not, does anyone have
another simple solution?

Thanks,

Rob





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.