[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Program for AS/400

Posted on 2011-03-12
Medium Priority
Last Modified: 2012-05-11
Hello Experts.

I need to develop a program for uploading files from a Windows server to a AS/400 machine. I need to check the integrity of the file once it has been uploaded to the AS/400, to see it has not changed. I have to give a proposal of what to use in the AS400 side, for example a FTP server, a custom program, a web service, or whatever I think is the best solution. In the windows end I know everything I need but I have no idea what to use or develop in the AS400 side. Any advice will be welcome, I know well how to program in C or java or can have another person to program what is needed. I would use an already done FTP server but not sure if it comes with AS/400 nor how to install it. As you can guess I almost know nothing about AS/400.

Question by:arturosm
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
  • 2
  • 2
  • 2
  • +2
LVL 57

Expert Comment

ID: 35119395
It has been years (15+) since I worked with an AS/400 and OS/400.  But here are a few generic possibilities:

You could use PKZip.  Zip the file on Windows, ftp to AS/400, then unzip.  I'm fairly sure that OS/400 does not come with PKZip, so you would need to get it.  PKZip has its own check for file integrity.

Using an more secure FTP, either sftp or FTPS.  I don't know if they are avaibale for OS/400.

Using MD5 check sum.  And again, I don't know if OS/400 come with the MD5 check sum program by default.

Expert Comment

ID: 35124682
Is the 400 local?  is the file huge?

if the 400 is local then you may be able to skip any security issues.
if the transfer is fast enough you could PUT the file then GET the same file back.   then compare the files on the windows side.

i have not seen a 400 in the past 15 years that did not have FTP installed.

Steve Bowdoin
LVL 35

Accepted Solution

Gary Patterson earned 1400 total points
ID: 35130312
What kind of file are you talking about uploading?  Are you uploading a PC stream file to the AS/400 IFS (stream-file to stream-file)?  Are you uploading a MS SQL Server table to a similarly-formatted AS/400 DB2 table?  Are you uploading a PC CSV file to an AS/400 DB2 table?

Assuming that this is just a simple stream file t- stream file transfer, then FTP is fine.  FTP client and server support are built into the the AS/400 operating system in all modern releases, as Steve indicates.  You may need to configure your FTP server and start it if it has never been set up:


As far as verification goes, you have lots of options.

1) Generate MD5 checksums for the source and target files, and compare the checksums.  Lots of Windows or Java tools out there that will do this for you.  To make things easy on you, you can use the AS/400 NetServer to map a Windows-compatible share to the AS/400 IFS file, which will enable you to use Windows-based tools for the file compare task.

Netserver:  http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzahl%2Frzahlusergoal.htm

2) Zip the file before uploading it, and use the AS/400 Qshell JAR command to unzip it.  Zipping the file causes a CRC to be generated, and unzipping using JAR will fail if the file was altered in transit.  As an alternative, you could again use Netserver to map a Windows share and then just use whatever Windows too you used to zip the file to unzip it.  You can also install and use this freeware AS/400 ZIP/UNZIP utility:


You can run simple commands directly from an FTP session using the RCMD directive:


To run QSHELL commands, you have to wrap them in the QSH command:

> QUOTE RCMD QSH 'JAR xxxxxxxxx'

3) Use Netserver to map a drive to the AS/400, and use the Windows file comparison tool of your choice to compare the two files.

4) Use Netserver to map a drive to the AS/400, and use a Windows file transfer utility that performs verification to perform the transfer.

5) My favorite: Use SFTP (SSH File Transfer Protocol), not to be confused with FTPS (FTP over SSL) or any other protocol).  SFTP is widely used in ecommerce because it is secure, encrypted, and reliable (reliable in the technical sense that it verifies that what is transmitted matches what is received).  This will require a little configuration, but is well worth it, in my opinion:


- Gary Patterson

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.

LVL 27

Expert Comment

ID: 35131398
You might also have a SQL table defined to receive the data on the AS/400. Then, ODBC/JDBC becomes reasonable. Many rules can be configured in DB2 to provide much of the validation. Or a stored procedure might be used to perform validation before applying uploaded rows to a target table.

As Gary points out, the type of file will make a lot of difference. A streamfile (e.g., non-database, as in an image file or even a text file) can be handled differently than a database transfer. Also, the AS/400 operating system version/release might be important unless you're dealing with a reasonably current release. (There are old ones out there, just as there are the rare Windows 98 PCs still at some business sites.)


Author Comment

ID: 35135540
Thanks Experts for your comments so far.

I will be uploading files of about 2 MB in size each, and there will be about 10-15 files per day. The files are ASCII text files, the idea is to put them in the AS/400 so that other already existing programs or jobs (I don´t know what they have running there) process  them. I just need to asure they get to the AS/400 without change. The windows machine and the AS/400 are in the same building and LAN. My project is mainly a windows programming task but have to upload the output files to the AS/400 after the end of the windows processing. I don´t know yet the features of the 400 machine (SO version, utility software installed, hardware resources, etc).

I will wait for your comments now that you have this info.

Thank you very much.
LVL 57

Expert Comment

ID: 35136849
Well, before we can make any comments you really need to find out what capabilities the AS/400 has.

We can't help you knowing only 1/2 of the picture.

So you really need to find out what level of OS/400 is installed.  If it has PKZip or not, but as Gary has stated (and I forgot) you could use the JAR command to unzip a file.  Although most people don't know it Java application files (JAR, RAR, WAR, EAR, and so on) are nothing but zip files with file suffixes other than ".zip".
LVL 35

Expert Comment

by:Gary Patterson
ID: 35137262
Assuming that you want to upload these ASCII stream files to the AS/400's IFS (as opposed to importing them into a DB2 table), then based on your volumes and validation requirements, then I suggest using the SSH File Transfer Protocol (SFTP) approach that I outlined above, since that will resolve both your needs for a file transfer mechanism and your validation needs, since SFTP is a reliable protocol.

- Gary Patterson

Assisted Solution

stevebowdoin earned 600 total points
ID: 35140027
My fellow experts are all correct.  Here is a simple solution. Bandwidth is not a problem.  Transfer speed is not a problem.

From the 400 command line execute these commands, one at a time.  CRTPF creates physical files.  The RCDLEN is the maximum record length you think you will need.  The SIZE is the initial number of records you may need.  Go ahead and guess big on the SIZE but don’t do *NOMAX


From the windows side create files named like “FILE01”.  Don’t use an extension.  Put them in a directory off the root named “pcsourcedir”.  Create a directory off the root called “pctargetdir”.

Put this command in a bat file named FTPBAT.BAT:
ftp -s:ftp.scr  where is the 400s IP address

put this into a file named FTP.SCR:
cd upload
lcd /pcsourcedir
mput *.*
lcd /pctargetdir
mget *.*

Execute the FTPBAT.BAT.
This will…
1      sign you on to the FTP server
2      prohibit prompting
3      change your current directory on the 400 to the UPLOAD libarary
4      change your current directory on the pc to pcsourcedir
5      put all file in pcsourcedir to UPLOAD
6      change your current directory on the pc to pctargetdir
7      get all files from UPLOAD
8      end ftp session

You can then run whatever windows program you need to insure that /pcsourcedir/file01 and /pctargetdir/file01 are the same.  Then check the rest of your files.

Steve Bowdoin

Author Closing Comment

ID: 35162526
Thank you.

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

649 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