I tried node-jt400 (Programs)

Programs Let's call the program.

CLLE (no parameters)

Try CALL a simple CL program with no parameters.


             SNDMSG MSG('SMPL010C was called') TOMSGQ(*SYSOPR)  


app.get("/smpl010c", function (req, res, next) {
  var SMPL010C = pool.pgm('SMPL010C', []); 
    function (result) {

There is one restriction on calling a program. That is, ** there is always a program to execute in the library list **. The following were all NG.

var SMPL010C = pool.pgm('MYLIB/SMPL010C', []); 
var SMPL010C = pool.pgm('MYLIB.SMPL010C', []); 
var SMPL010C = pool.pgm('/QSYS.LIB/MYLIB.LIB/SMPL010C.PGM', []); 



RPGLE (with parameters)

Try to CALL RPGLE with parameters.


     H DFTACTGRP(*NO)                                                              
     D main            PR                  EXTPGM('SMPL011R')                      
     D                                3P 0                                         
     D                               12A                                           
     D                               12A                                           
     D                               40A                                           
     D                                7P 3                                         
     D main            PI                                                          
     D id                             3P 0                                         
     D lname                         12A                                           
     D fname                         12A                                           
     D prof                          40A                                           
     D tokuten                        7P 3                                         
     D stmt            S            512A                                           
         stmt = 'insert into member' +                     
                ' values(?, ?, ?, ?, ?)';                  
         exec sql prepare s1 from :stmt;                   
         exec sql execute s1                               
               using :id, :lname, :fname, :prof, :tokuten; 
         tokuten = tokuten + 100;                          
         *inlr = *on;                                      
         return ;                                          


app.get("/smpl011r", function (req, res, next) {
    var SMPL011R = pool.pgm('smpl011r', [
        { type: 'DECIMAL', precision:  3, scale: 0, name: 'id' },
        { type: 'CHAR',    precision: 12, scale: 0, name: 'lname' },
        { type: 'CHAR',    precision: 12, scale: 0, name: 'fname' },
        { type: 'CHAR',    precision: 40, scale: 0, name: 'prof' },
        { type: 'DECIMAL', precision:  7, scale: 3, name: 'tokuten' }
        id: 120,
        lname: 'Date',
        fname: 'Masamune',
        prof : 'Appeared in white costume.',
        tokuten: 10
    }).then(function (result) { 

However, this program does not work properly. When I debugged SMPL011R to investigate the cause, I found that the Japanese parameters were not passed correctly. nodejt18.png


Java source modification of node-jt400

So, I will try to fix the Java source of node-jt400. Get the source from github.

git clone [email protected]:tryggingamidstodin/node-jt400.git mynode-jt400


The source to be modified is \ java \ src \ nodejt400 \ Pgm.java.


  public TextPgmParam(String name, Props paramDef)
    super(name, paramDef);
    parser = new AS400Text(paramDef.getFirstInt("size", "precision"), "Cp871");

Cp871 seems to be doing something wrong, so I did the following:


  public TextPgmParam(String name, Props paramDef)
    super(name, paramDef);
    parser = new AS400Text(paramDef.getFirstInt("size", "precision"));

After modifying the source, create a new jt400wrap.jar and replace jt400wrap.jar in \ myfolder \ node_modules \ node-jt400 \ java \ lib.

I ran it again and debugged it in the same place. This time the parameters are passed correctly.


The parameter "tokuten" has been added 100. It seems that the return value is also taken.



The poster does not take any responsibility for the source modification. Please do so at your own risk.

Added on December 28, 2017 I put the pre-built jt400wrap.jar in here.

Recommended Posts

I tried node-jt400 (Programs)
I tried node-jt400 (execute)
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 tomcat
I tried youtubeDataApi.
I tried refactoring ①
I tried FizzBuzz.
I tried JHipster 5.1
[I tried] Spring tutorial
I tried running Autoware
I tried QUARKUS immediately
I tried using TestNG
I tried Spring Batch
I tried using Galasa
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 using Java REPL
I tried source code analysis
I tried the FizzBuzz problem
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 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 a little digdag docker.run_options
I tried to summarize iOS 14 support
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 using Java8 Stream API
I tried Java's micro-benchmark tool JMH
I tried using JWT in Java
I tried GraphQL with Spring Boot
I tried to summarize Java learning (1)
Collatz number, Fibonacci number, triangular number I tried to make various sequence programs
I tried to understand nil guard
[Android] I tried using Coordinator Layout.
I tried installing CentOS 8 on ESXi 6.7