Please show your CREATE FUNCTION code for GETENV registration.
Also, what's the output when you run:
SELECT GETENV('HOME') || GETENV('HOME') FROM SYSIBM/SYSDUMMY1;
Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
Subject: [C400-L] Custom sql function based on C module
I have a very simple c module:
void GETENV( char* name,
char* msgtext )
char *val1 = NULL;
val1 = getenv( name );
if( val1 == NULL )
strcpy( returnMessage, "\0" );
strcpy( returnMessage, val1 );
*outind = 0;
Provided that I execute:
ADDENVVAR ENVVAR(HOME) VALUE('/noplace') REPLACE(*YES)
SELECT GETENV('HOME') FROM SYSIBM/SYSDUMMY1;
produces '/noplace' as expected. ( So far so good ).
When I wrap this sql function inside of another sql function like:
SET MYCOUNT = 5;
WHILE MYCOUNT > 0 DO
SET TEMP = '-';
SELECT GETENV('HOME') INTO TEMP FROM SYSIBM/SYSDUMMY1;
SET MYCOUNT = MYCOUNT - 1;
How can I just get /noplace ??
All SQL seems fine because in the loop I can substitute
SELECT DAYS('2005-02-22') INTO TEMP FROM SYSIBM/SYSDUMMY1;
and I simply get:
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.