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



I have a number of RPGLE's as CPP's for RTV type commands. Instead of the *NULL test, I use CEETSTA in a loop to set an array of booleans to indicate whether a parm was passed or not. Then, in the SetReturnVars() function, I test the Boolean to decide if I set the value. Named constants make it very readable.

Roger Harman
COMMON Certified Application Developer – ILE RPG on IBM i on Power




-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, June 10, 2020 6:30 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Getting a MCH3601 Pointer not set

Yes, you can use this with a *CMD interface when a parameter is not passed.

However, it is NOT reliable for a straight CALL where a parameter is
left off.   The area of memory where the pointer to the parameter
would've been is not set at all...  so if that spot in memory happens to
be a valid pointer, it'll think the parameter was passed and it won't be
reported as *NULL.   (But, if its not a valid pointer, your technique
would work...  but you should never rely on that.)


On 6/10/2020 5:14 AM, Åke Olsson wrote:
You could check if the address of the parameter is NULL - then the parameter
was not passed.

Like this

IF %ADDR([variable_name] = *NULL;
.... do something or whatever...
ENDIF;

I have found this particularily useful when using RPG programs as CPP for
commands that return values since you really do not know which values are
requested.




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.