I am trying to write a simple CL program to take a file name parameter and run the SQL in the file with COMMIT(*CHG) and DBGVIEW(*SOURCE). I am getting CPD018A: Path name contains embedded nulls:
Cause . . . . . : Path name /SQL/TRIGGERS/PCUSTOMERS_INSERT
???????????????????????????????????????????????????????????????????????.SQL
specified for SRCSTMF contains one or more embedded nulls (X'00'). Nulls are not allowed in a path name.
Here is my program:
PGM PARM(&FILE)
DCL VAR(&FILE) TYPE(*CHAR) LEN(100)
RUNSQLSTM SRCSTMF('/SQL/' || %TRIM(&FILE) || '.SQL') +
DBGVIEW(*SOURCE)
ENDPGM
I am calling the program like: CALL CCSQL PARM('TRIGGERS/PCUSTOMERS_INSERT')
.
This may just be a terrible workaround the real problem: I want to add SET OPTION
statements in my trigger:
CREATE OR REPLACE TRIGGER QS36F.PCUSTOMERS_INSERT
INSTEAD OF INSERT ON QS36F.PCUSTOMERS
REFERENCING NEW AS N
FOR EACH ROW
MODE DB2SQL
SET OPTION DBGVIEW =*SOURCE -- this causes a failure when run through JDBC
BEGIN
...
I haven't been able to figure out how to get the SET OPTION statements to go through JDBC, so I have to copy the statements into iSeries Navigator everytime. I thought I could improve this workflow with an external procedure calling this CL program to handle the precompile options before calling the SQL in the stream file, but I can't get the CL to run with the parameter I send to the procedure (or when I call it from the command line) CALL MYLIB.CCSQL('TRIGGERS/PCUSTOMER_INSERT');
I'm so far from my original goal at this point... any suggestions are very welcome. If it helps to know, I'm a PHP/SQL kind of person trying to make it on a iSeries 7.2 system.
Thank you for reading.