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



Thanks all.
The added by-reference parm will do it for me. I was stuck thinking that the returned parm would be defined on the PR line, and forgot the other possibilities.
The message passing is not as good an option in this case, as the "TYPE-A BAD STUFF" is not a result of an RPG/Database error that the operating system encounters -- rather it is a condition (as opposed to an error) the other platform encounters that the logic needs to detect and pass back. Probably could be done with a CPF9898 or some such thing, but a simple addition to the PR and PI list will suffice here.

We lone pioneers in small 1990s shops find this list to be a great resource.
Thanks for setting me straight.
Michael

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Larry Ducie
Sent: Thursday, September 29, 2011 5:52 AM
To: RPG400
Subject: Re: Changing a called sqlrpgle program to return a value


Hi Michael,

<snip>
Essentially the process should look like this:
DRIVERA:
...Do some stuff...
DOU done;
If not done;
...Do more stuff...
If COMMPGM(a : b : c) = 'TYPE-A BAD STUFF HAPPENED';
...Do failure stuff...
ITER;
else;
...Do other stuff...
endif;
endif;
enddo;
...Do cleanup stuff...
INLR = *on;

I'd really rather not go back to the PLIST approach...
</snip>

Your issue has absolutely nothing to do with the differences between using a *ENTRY PLIST and using a PI. It is your (incorrect) understanding of the two that is confusing you.

In both cases you can achieve what you want by simply adding an extra parameter to your PR/PI (or you PLIST if you still live in the 90s :-) ), which you pass BY REFERENCE (the default).
This allows COMMPGM to modify the passed parameter and the changes it makes be seen by DRIVERA.
The new parameter doesn't need to be optional as DRIVERA is the ONLY consumer of COMMPGM and it will be modified to pass it.

Your code would then look like this (with variable 'd' passed as the new parameter and checked post-call):
DRIVERA:
...Do some stuff...
DOU done;
If not done;
...Do more stuff...
COMMPGM(a : b : c :d) <=== d is the new parameter you pass and check once the call is complete
If d = 'TYPE-A BAD STUFF HAPPENED';
...Do failure stuff...
ITER;
else;
...Do other stuff...
endif;
endif;
enddo;
...Do cleanup stuff...
INLR = *on;

HTH

Cheers

Larry Ducie

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.