Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Calling Java from AS/400 native code...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling Java from AS/400 native code...

    Cliff, There isn't a lot of difference in performance either way. QShell is a little more flexible and easier to call with a variable (like qcmdexc is). If performance is concern, keeping the job active is usually a priority because starting a new JVM is pretty expensive. That usually means using some sort of server. David Morris

  • #2
    Calling Java from AS/400 native code...

    When the Java Virtual Machine communicates with OS/400 objects, it does so through the host servers. In order to sign on to a host server, the normal procedure is to use a user ID and password. However, the native optimizations of the AS/400 JVM allow it to bypass that and use the user ID and password of the current job. If the user profile has no password, this fails. Is this a bug or a feature? I don't know, but it's pretty much how the native optimizations have worked from day one, from what I understand. As to RUNJVA vs. QSH, at the time Don Denoncourt and I designed the command, we found that the only way to be able to run the program in batch and redirect the output to a file was by using QSH. RUNJVA, for whatever reason, didn't work the same way. I really can't recall; this was way back in V4R2. Since then, I have always submitted QSH rather than RUNJVA, and have never thought twice about it. You might want to try changing the CL to use RUNJVA instead - if you do, let us know what happens! Joe Pluta

    Comment


    • #3
      Calling Java from AS/400 native code...

      Thanx David/Joe, Always a pleasure to hear from either of you two. Joe, You and Don designed which command RUNJVA or QSH? I thought these were IBM designed commands. Did IBM get the idea from you two? If I get some spare time I'll try to benchmark the two commands to see if there is any true performance difference. I have been dreaming up a JVM server application but I wouldn't know exactly how to implement it. By the way, does anybody know how to retrieve the exit status of a Java program from native code? I recall reading about finding the status of a program compile and I'm thinking it may be similar but I can't remember exactly how. Kind Regards, Cliff

      Comment


      • #4
        Calling Java from AS/400 native code...

        hey joe! There's an idea for you! See if you can get IBM to give you royalties for the QSH and RUNJVA commands! ha! Yeah! I'll bet you can do it! YEAH! ha! Clifton - Sorry. Couldn't resist that. I think Joe means "At the time he designed the CPYSPLFPDF command..." not the QSH and RUNJVA commands. Those

        are

        IBM commands.

        Comment


        • #5
          Calling Java from AS/400 native code...

          Oh, I get it. That would make sense. Thanx Shannon.

          Comment


          • #6
            Calling Java from AS/400 native code...

            I gotta be more careful in my typing

            Comment


            • #7
              Calling Java from AS/400 native code...

              Hello all, I have a number of questions here. 1st off I'm trying to determine what is the best method for calling Java from say a CL program. We use the SNDSPLFPDF utility authored by Joe Pluta in many programs and typically run it in batch. The Java code is call from the command proceesing CL program via QSH. I'm not exatcly sure why this method was choosen over using RUNJVA. My thoughts on this are that the program would endure extra overhaed of firing up the QShell environment when only one Java program is being called. However I'm not completely sure if a straight RUNJVA command would give any additional performace boost. My understanding is that running either Java programs or the QShell environment requires a DSM session along with some data queues to be created. I'm not exatcly sure how this works if the call is made from a batch job. Next up, I need to know how to find out the exit status of a Java program. I thought that if the Java ended with an exit status of 1 that it would generate a CPF escape message. I also tried throwing an exception (which is the equivalent of System.exit(1)) to no avail. Is it possible to send an escape message from a Java program to the calling native code so that the caller will be aware of a problem? If so, how? Lastly, I just found out an intersting tidbit. Apparently, a call to Java made from a batch process running under a user profile with password *NONE cannot execute CL commands. I ran into this problem recently with the SNDSPLFPDF utility when running it under a group user profile. It failed when it tried to execute a CRTPF in QTEMP throwing a general security error. After supplying a password to this (and many other profiles that we tested with) the program ran fine. The funny thing is that this is a limitation only to Java were any other method of executing the same command in batch with the same profile does not fail. Has anyone else experienced this or have more info on it? My thanx to all who reply, Cliff

              Comment

              Working...
              X