Solved

Upload file to AS 400

Posted on 2014-09-04
8
983 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
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
0
 
LVL 35

Accepted Solution

by:
Gary Patterson earned 334 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:

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

- Gary
0
 
LVL 86

Expert Comment

by:CEHJ
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
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 35

Assisted Solution

by:Gary Patterson
Gary Patterson earned 334 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.
0
 
LVL 33

Assisted Solution

by:shalomc
shalomc earned 166 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

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 35

Expert Comment

by:Gary Patterson
ID: 40312077
@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
ID: 40335220
Thanks all.
Does it mean I should use relevant FTP account in AS 400, to upload the JAR files?
0
 
LVL 33

Expert Comment

by:shalomc
ID: 40335280
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

828 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