Installation Overview

OS/400 Objects

  1. Download 'pop3.exe' and execute it on Windows95/98/NT/2000/XP to extract 'pop3.savf' and "Rcvmail.java".
  2. Create save-file on your OS/400.
  3. Connect to the OS/400 using any FTP client software.
  4. Put the distribution (pop3.savf) to the save-file in binary mode.
  5. Create/restore object to library "POP3" from the save-file using RSTOBJ or RSTLIB command.
  6. Run the REXX procedure.

Stream files

  1. Download JavaMail and JAF (JavaBeans Activation Framework) and unzip downloaded files.
  2. Create directory "/JavaMail" on your OS/400.
  3. Connect to the OS/400 using any FTP client software.
  4. Put the Java source file "Rcvmail.java" to the directory "/JavaMail" in binary mode.
  5. Put Sun's .jar files, "mail.jar", "activation.jar" and "mailapi.jar" (this file is not necessary for JDK 1.2 or later) to the directory "/JavaMail" in binary mode.
  6. CPY or put "jt400.jar" to the directory "/JavaMail" in binary mode.
  7. Compile the Java program.

Note

"jt400.jar" can be obtained many places, e.g. if your are using V5R2 and Access for Wndows, you may find "jt400.jar" at :

To copy from PC to AS/400, use FTP, NetServer, etc. To copy inside OS/400, use CPY command, for example :

> CPY OBJ('/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar') TOOBJ('/JavaMai
  l/jt400.jar')

In this senario, "jt400.jar" is copoied to directory "/Javamail" but it is absolutely possible to use existing "jt400.jar" if you specify the CLASSPATH environment variable when compile and run the Java program.

In either case, run CRTJVAPGM to achive the best performance.

> SBMJOB CMD(CRTJVAPGM CLSF('/JavaMail/*') OPTIMIZE(40))
  Job 081009/XXXXX/QDFTJOBD submitted to job queue QBATCH in library QGPL.

As CRTJVAPGM takes long time and enormous CPU time, I recommned to run the commnad when the system is idle.


Sample instruction

Create save-file on the target AS/400:

> CRTSAVF FILE(QGPL/POP3)
  File POP3 created in library QGPL.

Send save-file and stream files from Windows95/98/NT/2000/XP command prompt:

C:\>ftp your_as400_hostname
Connected to ????.
220-QTCP AT ????.
220 CONNECTION WILL CLOSE IF IDLE MORE THAN 5 MINUTES.
User (????:(none)): as400_user_id
331 ENTER PASSWORD.
Password:enter_password_for_the_user_id
230 ???? LOGGED ON.
ftp> bi
200 REPRESENTATION TYPE IS BINARY IMAGE.
ftp> quote site namefmt 0
250  NOW USING NAMING FORMAT "0".
ftp> put pop3.savf qgpl/pop3
200 PORT SUBCOMMAND REQUEST SUCCESSFUL.
150 SENDING FILE TO MEMBER POP3 IN FILE POP3 IN LIBRARY QGPL.
250 FILE TRANSFER COMPLETED SUCCESSFULLY.
ftp: 101904 bytes sent in 4.33Seconds 23.56Kbytes/sec.

(Put stream files)

ftp> quote site namefmt 1
250  NOW USING NAMING FORMAT "1".
ftp> cd /JavaMail
250 "/JavaMail" IS CURRENT DIRECTORY.
ftp> put activation.jar
200 PORT SUBCOMMAND REQUEST SUCCESSFUL.
150 SENDING FILE TO /JavaMail/activation.jar
250 FILE TRANSFER COMPLETED SUCCESSFULLY.
ftp: 54665 bytes sent in 0.00Seconds 54665000.00Kbytes/sec.
ftp> put jt400.jar
200 PORT SUBCOMMAND REQUEST SUCCESSFUL.
150 SENDING FILE TO /JavaMail/jt400.jar
250 FILE TRANSFER COMPLETED SUCCESSFULLY.
ftp: 3436558 bytes sent in 1091.23Seconds 3.15Kbytes/sec.
ftp> put mail.jar
200 PORT SUBCOMMAND REQUEST SUCCESSFUL.
150 SENDING FILE TO /JavaMail/mail.jar
250 FILE TRANSFER COMPLETED SUCCESSFULLY.
ftp: 305434 bytes sent in 49.86Seconds 6.13Kbytes/sec.
ftp> put Rcvmail.java
200 PORT SUBCOMMAND REQUEST SUCCESSFUL.
150 SENDING FILE TO /JavaMail/Rcvmail.java
250 FILE TRANSFER COMPLETED SUCCESSFULLY.
ftp: 20659 bytes sent in 0.00Seconds 20659000.00Kbytes/sec.

(Optionally, you may put "mailapi.jar" also.)

ftp> dir
200 PORT SUBCOMMAND REQUEST SUCCESSFUL.
125 LIST STARTED.
XXXXX           54665 03/05/18 01:06:11 *STMF      activation.jar
XXXXX         3436558 03/05/18 01:39:50 *STMF      jt400.jar
XXXXX          305434 03/05/18 01:40:55 *STMF      mail.jar
XXXXX           20659 03/05/18 01:41:24 *STMF      Rcvmail.java
250 LIST COMPLETED.
ftp: 255 bytes received in 0.00Seconds 255000.00Kbytes/sec.
ftp> quit
221 QUIT SUBCOMMAND RECEIVED.

Go back to the 5250 session to restore and make objects. You should examine source file POP3/SOURCE.MAKE to appropriately complie object. For example, if you are using V5R2, new OUTPUT paramter can be specified to RUNJVA command.

> RSTLIB SAVLIB(POP3) DEV(*SAVF) SAVF(QGPL/POP3)
  2 objects restored from POP3 to POP3.
> CHGCURLIB CURLIB(POP3)
  Current library changed to POP3.
> STRREXPRC SRCMBR(MAKE) SRCFILE(POP3/SOURCE)
  Start RCVM compilation.
   You must have authority to create objects.

      * * * * * * * * * * * * * * * * * * * * * *

  creating CL program ...
    result-> 0
  creating CMD definition ...
    result-> 0
  creating database files ...
    result-> 0
    result-> 0

  Compile finished. Confirm error(s) if exists.

  Press ENTER to end terminal session.
> DLTF FILE(QGPL/POP3) Object POP3 in QGPL type *FILE deleted.

Start Qshell session to compile the Java program :

> QSH
> cd /JavaMail
  $
> ls -la
  total: 3.776 megabytes
  drwxrwxrwx   2 XXXXX   0                 86016 May 12 11:40 .
  drwxrwxrwx  42 QSYS    0                208896 May 11 12:55 ..
  -rwxrwxrwx   1 XXXXX   0                 54665 May 12 11:14 activation.jar
  -rwxrwxr-x   1 XXXXX   0               2749457 Aug  3  2001 jt400.jar
  -rwxrwxrwx   1 XXXXX   0                305434 May 12 11:14 mail.jar
  -rwxrwxrwx   1 XXXXX   0                172919 May 12 11:18 mailapi.jar
  -rwxrwxrwx   1 XXXXX   0                 20659 May 11 12:59 Rcvmail.java
  $

Cmpile the Java program "Rcvmail" in accordance with JDK enviroment of your AS/400. You may, of course, compile the program on you PC which has JDK or Java development environment and send compled "Rcvmail.class" to "/JavaMail" directory of AS/400.

Here's how I compiled the program using OS/400 V4R5 and V5R2 as a test. Earlier version of OS/400 JDKs can compile the program but I have no test environment (as always, everything's at your own risk).

- Compile under V4R5 (Default JDK 1.1.8)

> javac -classpath .:./mail.jar:./mailapi.jar:./activation.jar:./jt400.jar:/QIB
  M/ProdData/Java400/jdk118/lib/classes.zip -deprecation Rcvmail.java
  Rcvmail.java:58: Note: The constructor java.io.PrintStream(java.io.OutputStre
  am) has been deprecated.
          PrintStream consoleout = new PrintStream(new FileOutputStream(debugfi
  le, true));
                                   ^
  Note: Rcvmail.java uses a deprecated API.  Please consult the documentation f
  or a better alternative.
  2 warnings
  $

- Compile under V4R5 (JDK 1.3)

> /QIBM/ProdData/Java400/jdk13/bin/javac -classpath .:./mail.jar:./activation.j
  ar:./jt400.jar:/QIBM/ProdData/Java400/jdk13/lib/rt.jar Rcvmail.java
  $

- Compile under V5R2 (Default JDK 1.3.1)

> javac -classpath .:./mail.jar:./activation.jar:./jt400.jar Rcvmail.java
$



[Home]