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



Hi Bruce,

I'm no expert, I'm trying to figure this stuff out. I'm looking at the following page of the Information Center:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rbam6/passp.htm

Here's a quote from that page:

- -

When calling an original program model (OPM) CL program, the number of parameters that are passed to it must exactly match the number that is expected by the program. The number that is expected is determined at the time the program is created. (The operating system prevents you from calling a program with more or fewer parameters than the program expects). When calling an ILE program or procedure, the operating system does not check the number of parameters that are passed on the call. In addition, the space where the operating system stores the parameters is not reinitialized between procedure calls. Calling a procedure that expects "n" parameters with "n-1" parameters makes the system use whatever is in the parameter space to access the "nth" parameter. The results of this action are very unpredictable. This also applies to procedures written in other ILE languages that call CL procedures or are called by CL procedures.

- -

That paragraph states "When calling an ILE program or procedure", then proceeds to say the space is not reinitialized between calls. Now that I'm reading this again after you've told me I'm wrong, I do see that it uses the verbiage "procedure calls"... but the fact that (before that) it says "program or procedure" makes this paragraph very easy to interpret the way I originally interpreted it (that it applies to both program and procedure calls).

As usual, IBM documentation is anything but clear.


Bruce Vining wrote:
Hi, Scott
Should have stopped on your first note lol. The code path for a *PGM call will get you the exception. There was a bug along these lines a loooong time ago, but it has been corrected (perhaps as long as two years ago?).
Bruce

Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:
...and in ILE CL, the parameter storage isn't reinitialized between calls, is it? So you couldn't rely on the MCH3601 being generated each time, unless *OMIT is passed from the CALL command, right?

I'm with Francis. Use a command front-end. Or, if it's REALLY important that you use the CALL command, put an RPG front-end over your CL program.


Scott Klement wrote:
Hi Bruce,

Wouldn't you still get a "Parameters passed on CALL do not match those required." error when you tried to call this? Unless you used ILE CL, that is?


Bruce Vining wrote:
Sure. But it does need to be a *PGM.

PGM PARM(&PARM1) DCL VAR(&PARM1) TYPE(*CHAR) LEN(1) DCL VAR(&TEST) TYPE(*CHAR) LEN(1) CHGVAR VAR(&TEST) VALUE(&PARM1) MONMSG MSGID(MCH3601) EXEC(DO) RCVMSG MSGTYPE(*LAST) SNDPGMMSG MSG('Not sent') TOPGMQ(*EXT) RETURN ENDDO IF COND(&PARM1 = Y) + THEN(SNDPGMMSG MSG('Sent') TOPGMQ(*EXT)) ELSE CMD(SNDPGMMSG MSG('Sent but no Y') + TOPGMQ(*EXT)) ENDPGM
Bruce Vining




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.