execute There is also a method called execute, which is not in the coding example. I guess it seems that you can issue SQL with no return value.
So, I tried to see if QCMDEXC can be executed. If OVRDBF can be executed, members can use it.
First, add a member (ADDMEMBER) to the physical file: MEMBER. (The naming has become a little complicated.)
ADDPFM FILE(MYLIB/MEMBER) MBR(ADDMEMBER) TEXT('Add member')
The following data was added by DFU.
SQLexecute.js
app.get("/execute", function (req, res, next) {
let execstmt = "CALL QCMDEXC('OVRDBF FILE(MEMBER) TOFILE(MYLIB/MEMBER) MBR(ADDMEMBER) OVRSCOPE(*JOB)',70)";
let sqlstmt = "select * from member";
pool.execute(execstmt).then(
function (result) {
pool.query(sqlstmt).then(
function (result){
res.json(result);
}
)
});
});
I tried to run it.
OVRDBF doesn't seem to be working. When I checked with WRKACTJOB, there were two QZDA SOINIT, and OVRDBF and SQL were different jobs.
Last time The transaction I tried seems to use the same pool, so I rewrote it there.
SQLexecute.js
app.get("/execute2", function (req, res, next) {
pool.transaction(function (tran) {
return tran.execute("CALL QCMDEXC('OVRDBF FILE(MEMBER) TOFILE(MYLIB/MEMBER) MBR(ADDMEMBER) OVRSCOPE(*JOB)',70)"
).then(function () {
return tran.query("select * from member").then(
function (result)
{
res.send(result);
}
)});
});
});
This time it went well.
Recommended Posts