Solved

Upload file to AS 400

Posted on 2014-09-04
8
826 Views
Last Modified: 2014-09-21
Hi,
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?
0
Comment
Question by:HuaMinChen
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
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
0
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 334 total points
Comment Utility
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:

http://www.itjungle.com/fhg/fhg032206-story02.html

- Gary
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
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
0
 
LVL 34

Assisted Solution

by:Gary Patterson
Gary Patterson earned 334 total points
Comment Utility
@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.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 32

Assisted Solution

by:shalomc
shalomc earned 166 total points
Comment Utility
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

user
password
quote site namefmt 1
quote site listfmt 1
cd /yourfolder
bin
put yourjarfile.jar
quit


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 :(
0
 
LVL 34

Expert Comment

by:Gary Patterson
Comment Utility
@shalomc:

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.
0
 
LVL 10

Author Comment

by:HuaMinChen
Comment Utility
Thanks all.
Does it mean I should use relevant FTP account in AS 400, to upload the JAR files?
0
 
LVL 32

Expert Comment

by:shalomc
Comment Utility
Yes.
Any user on the AS400 can by default connect via FTP, but it is best to have a dedicated upload user profile.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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 …

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now