Bob,
An SQL "INSERT ... INTO ..." statement inserts data into a DB2 table.
An IFS streamfile is NOT a "table" (or physical file).
However, you can call an SQL stored procedure or UDF or UDTF that can write to the IFS from within SQL.
See:
https://github.com/BirgittaHauser/Write-to-IFS-with-SQL ;
for some excellent examples by Birgitta Hauser.
Hope that helps,
Mark S. Waterbury
On Wednesday, August 26, 2020, 10:46:49 AM EDT, Bob Schwartz <rschwartz@xxxxxxxxxxxxxxx> wrote:
Looking for some help on the proper syntax for SQL Insert Into statement.
Trying to write a CLP to extract some audit journal entries and then copy them out to the IFS for analysis.
I have the RUNSQL statement below, the slashes "/" in the IFS file path are giving me a problem.
I'm trying to avoid creating a PF and then running CPYTOIMPF. Thanks for your help.
RUNSQL SQL('INSERT INTO /home/gcaudit/A0825ZC.csv SELECT ZCTSTP,
ZCJOB, ZCUSER, ZCNBR, ZCPGM, ZCPGMLIB, ZCUSPF, ZCSYNM,
ZCRADR, ZCONAM, ZCOLIB, ZCOTYP, ZCACTP, ZCODTA, ZCPNM
FROM GCAUDIT.A0825ZC') NAMING(*SQL)
Token / was not valid. Valid tokens: <IDENTIFIER>.
RUNSQLSTM or RUNSQL command failed.
Thank you,
Bob Schwartz
Director of Technology Services
Glynn County Schools
1313 Egmont St.
Brunswick, GA 31520