Upload file to AS 400

Posted on 2014-09-04
Medium Priority
Last Modified: 2014-09-21
Do you have any ideas to execute one .jar file, which has been created in Win 7 environment, within AS 400 OS? How to upload the relevant file to AS 400 from Win 7?
Question by:HuaMinChen
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
LVL 86

Expert Comment

ID: 40305374
A jar file is executed the same way on any system - by running it with a JVM. Your AS400 box would need one.

The safest way to transfer a file to a Unix server is using secure FTP
LVL 35

Accepted Solution

Gary Patterson earned 1002 total points
ID: 40305782
Even though the AS/400 (iSeries, IBM i) isn't a Unix box (it does have an AIX emulation environment called PASE, though), FTP is one of the alternatives for transferring files.  sftp is part of an optionally-installable LPP, so it is not necessarily installed on every system.

Other options include IBM i Navigator (a component of IBM i Access for Windows), which provides a GUI drag-and drop interface to the IBM.

IBM i NetServer is a SMB/CIFS-compatible file transfer interface that is compatible with Windows file sharing, so if NetServer is configured, you can just connect to the IBM i Integrated File System using Windows Explorer, or even map a Windows drive to a share in the IFS.

Java is also an optionally-installable licensed program product on IBM i.  To determine if Java is installed GO LICPGM, select option 10, and look for JDK and J2SE or Java SE in the Description.  You can also check for Java by going into Qshell (type QSH and press enter), and typing "java -version" on the QSH Command Entry line.

Java programs can be executed from the native IBM i environment, or from the Qshell environment, or PASE environment (CALL QP2TERM).  Qshell and PASE  provide an AIX compatible command shell, is are the most common ways to work with Java on IBM i.

In QSH or PASE, you just use the "java" command, like you would in any other environment:

java -jar jar-file

Of course you'll have to have your classpath set up correctly, just like in any Java environment.

Here is a nice detailed article that may be of some help:


- Gary
LVL 86

Expert Comment

ID: 40305791
Even though the AS/400 (iSeries, IBM i) isn't a Unix box (it does have an AIX emulation environment called PASE, though)

Thanks for that clarification
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

LVL 35

Assisted Solution

by:Gary Patterson
Gary Patterson earned 1002 total points
ID: 40305927
@CEHJ:  It is a common misconception that AS/400 / iSeries / are Unix boxes.  I think people (that don't work on IBM midrange) tend to put operating systems into two categories:  Windows and Unix/Linux.  

But IBM S/38, AS/400, and iSeries hardware run an operating system that was created from the ground up, and is not at all related to Unix.  It has changed names over time: CPF, OS/400, and i5/OS.  

Now that IBM has merged the "iSeries" and "pSeries" hardware into one hardware line, we now just have shared Power Systems hardware that runs the IBM i operating system.  The same Power Systems hardware can also run AIX and Linux.  It is also possible to run multiple partitions in a single systems, each running a different OS.

To make things even more confusing, IBM i offers an embedded AIX environment called PASE that can run AIX binaries inside and IBM i partition without the need to create a separate AIX partition.  Closest parallel I can come up with is cygwin in Windows.
LVL 33

Assisted Solution

shalomc earned 498 total points
ID: 40311047
Java classes and jars must reside in the Integrated File System (IFS) and not in the libraries that AS400 programmers are familiar with.

If you transfer the jar file via FTP, you must place it in a folder in IFS and use binary mode to copy.
Because of incompatibility with the rest of the world, many graphical FTP clients will fail miserably with this platform, so I recommend using the command line ftp client every windows has.

Your FTP commands would look like

quote site namefmt 1
quote site listfmt 1
cd /yourfolder
put yourjarfile.jar

On the AS400 side, after login you get to the native "shell" which is the menu system.
While it is possible to execute a jar file via the RUNJVA command, an easier way is to invoke the qshell environment like Gary mentioned, and execute from there.
For large jar files, the first execution will take much longer than the next ones because the server creates intermediate code for the entire jar.
Depending on the server hardware and OS version, you may see that the AS400 java execution time is inferior to even a weak intel server, but that's normal :(
LVL 35

Expert Comment

by:Gary Patterson
ID: 40312077

One note about this comment

For large jar files, the first execution will take much longer than the next ones because the server creates intermediate code for the entire jar.

That was true in older version of the operating system, but in current versions of the OS, native code objects are no longer generated - the JVM works just like it does on other platforms and either interprets Java code or uses JIT.

JIT was first available in V4R4, but performance wasn't good.  In V5R2, JIT just about caught up to native compilation, and most of the time generating a native code object wasn't a benefit after that.

With the "new" IBM Technology for Java JVM, native object creation (CRTJVAPGM) is no longer even an option.   IT4J was introduced as an optional JVM in V5R4, became the default JVM in V6R1 (native JVM was still available though), and is the only JVM supplied by IBM in V7R1 and later.
LVL 11

Author Comment

ID: 40335220
Thanks all.
Does it mean I should use relevant FTP account in AS 400, to upload the JAR files?
LVL 33

Expert Comment

ID: 40335280
Any user on the AS400 can by default connect via FTP, but it is best to have a dedicated upload user profile.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question