Solved

Program for AS/400

Posted on 2011-03-12
9
1,613 Views
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.

Regards.
0
Comment
Question by:arturosm
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 57

Expert Comment

by:giltjr
Comment Utility
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.
0
 
LVL 5

Expert Comment

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

Accepted Solution

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

http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzaiq/rzaiq.pdf

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:

http://www.easy400.net/zip/html/page1.htm

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

> QUOTE RCMD UNZIP ......

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:

http://www.redbooks.ibm.com/redpapers/pdfs/redp4163.pdf

- Gary Patterson

0
 
LVL 27

Expert Comment

by:tliotta
Comment Utility
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.)

Tom
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:arturosm
Comment Utility
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.
0
 
LVL 57

Expert Comment

by:giltjr
Comment Utility
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".
0
 
LVL 34

Expert Comment

by:Gary Patterson
Comment Utility
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
0
 
LVL 5

Assisted Solution

by:stevebowdoin
stevebowdoin earned 150 total points
Comment Utility
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



CRTLIB LIB(UPLOAD)
CRTPF FILE(UPLOAD/FILE01) RCDLEN(512) SIZE(100000)
CRTPF FILE(UPLOAD/FILE02) RCDLEN(512) SIZE(100000)
CRTPF FILE(UPLOAD/FILE03) RCDLEN(512) SIZE(100000)
CRTPF FILE(UPLOAD/FILE04) RCDLEN(512) SIZE(100000)
CRTPF FILE(UPLOAD/FILE05) RCDLEN(512) SIZE(100000)
CRTPF FILE(UPLOAD/FILE06) RCDLEN(512) SIZE(100000)
CRTPF FILE(UPLOAD/FILE07) RCDLEN(512) SIZE(100000)
CRTPF FILE(UPLOAD/FILE08) RCDLEN(512) SIZE(100000)

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 10.7.1.67  where 10.7.1.67 is the 400s IP address

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

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
0
 

Author Closing Comment

by:arturosm
Comment Utility
Thank you.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

763 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

9 Experts available now in Live!

Get 1:1 Help Now