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



Scott Klement wrote:

That's interesting. I'm pretty sure CEETSTA does exactly the same thing as if %ADDR(PARM)=*NULL....

So I guess I'm wondering what's going on here... How the heck does CEETSTA solve the problem? It does the same thing!


That's my understanding too. CEETSTA is advertised to work with omitted parameters, not unpassed parameters. And if the parameter is passed but omitted, %addr works fine.

I just tested this using C as the caller. When I call the program, here is what the C module passes, and the three values that RPG procedure gets from calling CEETSTA for parameters 1, 2, 3.

Parameters from C RPG output
--------------------------- ----------
(null,null,null) 0,0,0
( ) 0,0,0
("abcde") 1,0,0
( ) 1,0,0 <---- bad
("abcde", "12345") 1,1,0
("abcde", "12345", "ABCDE") 1,1,1
("abcde") 1,1,1 <---- bad

Here's my code. Compile with CRTCMOD, CRTRPGMOD, CRTPGM, taking the defaults.

main()
{
char *nullPointer = 0;
myProc(nullPointer, nullPointer, nullPointer);
myProc();
myProc("abcde");
myProc();
myProc("abcde", "12345");
myProc("abcde", "12345", "ABCDE");
myProc("abcde");
}

H NOMAIN
D CEETSTA PR EXTPROC( 'CEETSTA' )
D present 10I 0
D parmNum 10I 0 CONST
D fb 12A OPTIONS(*OMIT)
D myProc PR extproc('myProc')
D parm1 1A
D parm2 1A
D parm3 1A
P myProc b export
D myProc PI
D parm1 1A
D parm2 1A
D parm3 1A
D present1 s 10i 0
D present2 s 10i 0
D present3 s 10i 0
/free
CEETSTA (present1 : 1 : *omit);
CEETSTA (present2 : 2 : *omit);
CEETSTA (present3 : 3 : *omit);
dsply (%char(present1) + ',' + %char(present2) + ','
+ %char(present3));
/end-free
P myProc e


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.