I tried node-jt400 (execute)

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. nodejt13.png

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. nodejt14.png

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);          
            } 
        )});
    });
});

nodejt15.png

This time it went well.

Recommended Posts

I tried node-jt400 (execute)
I tried node-jt400 (Programs)
I tried node-jt400 (Transactions)
I tried node-jt400 (Environment construction)
I tried node-jt400 (IFS write)
I tried node-jt400 (SQL Update)
I tried node-jt400 (SQL query)
I tried node-jt400 (SQL stream)
I tried node-jt400 (IFS read)
I tried Spring.
I tried youtubeDataApi.
I tried refactoring ①
I tried FizzBuzz.
I tried JHipster 5.1
I tried running Autoware
I tried using Gson
I tried QUARKUS immediately
I tried using TestNG
I tried using Galasa
[Java 11] I tried to execute Java without compiling with javac
I tried DI with Ruby
I tried using azure cloud-init
I tried Spring State machine
I tried Drools (Java, InputStream)
I tried Rails beginner [Chapter 1]
I tried the Docker tutorial!
I tried using Apache Wicket
I tried the VueJS tutorial!
I tried putting XcodeGen + SwiftPM
I tried Rails beginner [Chapter 2]
I tried UPSERT with PostgreSQL.
I tried BIND with Docker
I tried to verify yum-cron
I tried Jets (ruby serverless)
I tried metaprogramming in Java
I tried using anakia + Jing now
I tried Angular tutorial + SpringBoot + PostgreSQL
I tried to chew C # (indexer)
I tried something called recursive search
I tried using Spring + Mybatis + DbUnit
I tried using JOOQ with Gradle
[K8s] I tried communication between pods!
I tried morphological analysis with MeCab
I tried to interact with Java
I tried UDP communication with Java
I tried to explain the method
I tried putting Domino11 in CentOS7
I tried the Java framework "Quarkus"
[Rails] I tried deleting the application
I tried using Java8 Stream API
I tried Java's micro-benchmark tool JMH
I tried using JWT in Java
I tried to summarize Java learning (1)
I tried to understand nil guard
[Android] I tried using Coordinator Layout.
I tried installing CentOS 8 on ESXi 6.7
I tried Flyway with Spring Boot
I tried using Pari gp container
I tried using WebAssembly Stadio (2018/4/17 version)
I tried to summarize Java 8 now
I tried to chew C # (polymorphism: polymorphism)