I have the following code in my RPG program to create a file in QTEMP. The exact same SQL statement works perfectly from STRSQL. From RPG, it runs without any errors, and does create the file, but the file is always empty. I do not get any errors returned, so I am quite confused.
Here is the SQL statement from STRSQL:
And here is the RPG program (debug display of variable command follows):
Here is the value of the variable command when I am in debug:
Here is the SQL statement from STRSQL:
PHP Code:
declare global temporary table IS1074FSA6 as (
SELECT * FROM TABLE(
SYSTOOLS.AUDIT_JOURNAL_CP(
STARTING_TIMESTAMP => '2023-09-01',
ENDING_TIMESTAMP => '2023-09-30'))
) WITH DATA
And here is the RPG program (debug display of variable command follows):
PHP Code:
command =
'declare global temporary table IS1074FSA6 as ( ' +
'SELECT * FROM TABLE( ' +
'SYSTOOLS.AUDIT_JOURNAL_CP( ' +
'STARTING_TIMESTAMP => ' + q + parm_FrDate + q + ',' +
'ENDING_TIMESTAMP => ' + q + parm_ToDate + q + ')) ' +
') with data';
exec SQL execute immediate :command;
Here is the value of the variable command when I am in debug:
PHP Code:
declare global temporary table IS1074FSA6 as ( SELECT * FROM
TABLE( SYSTOOLS.AUDIT_JOURNAL_CP( STARTING_TIMESTAMP => '20
23-10-04',ENDING_TIMESTAMP => '2023-10-04')) ) with data
Comment