Guild Companies, Inc.  
 
Midrange Guru - Tech Tips
OS/400 Edition
Volume 2, Number 27 - April 10, 2002

Avoiding a Sign-On with Java

Hey, David:

I am working on a simple Java utility that copies an OS/400 IFS file. The program works fine from my PC, but when I run my program within Qshell or with the OS/400 Java command, I get an error that says com.ibm.as400.access.AS400SecurityException: Password is not set. When I run this program from my PC, I get a prompt for my password. I can specify the user and password in my code, but I hate to hardcode that sort of thing.

-- RC

A while back, I wrote about using native optimizations (see Boosting Java Performance ) when running Java on the iSeries. Another neat thing about native optimization is that most of the toolbox classes can use the current job's authentication, bypassing the need to enter a user and password.

In most cases, using the native optimizations is as easy as adding the appropriate native JAR file to your classpath. You don't mention what release you are running, but older releases of OS/400 use the native optimizations by default, so I will assume that you are running V4R5 or V5R1. Also, I will assume that you are using the 1.2 or 1.3 Java Development Kit (JDK) because the 1.1.x JDKs automatically include the native optimizations on the classpath.

There are two versions of the Java Toolbox that you can use, JTOpen and the Licensed Program Product (LPP). If you are using the LPP, you would add /QIBM/ProdData/Java400/jt400ntv.jar to your classpath to get the native optimizations. If you are using JTOpen, add jt400native.jar to your classpath.

If you are using JDBC connections, you use the com.ibm.dbd.jdbc.app.DB2Driver class rather than com.ibm.as400.access.AS400JDBCDriver. You will also have to use db2 in the URL rather than as400. Thus, your connection code ends up looking something like:

DriverManager.registerDriver(new 

com.ibm.db2.jdbc.app.DB2Driver());
conn = 

DriverManager.getConnection("jdbc:db2://localhost");

Here are a few observations about the native optimizations. To share the same job when using the CommandCall or ProgramCall classes, call the setThreadSafe(true). This will allow you to share the same environment between command or program calls. This will not work for commands that are not threadsafe. I also ran the following command to compile the jar files that came packaged as part of JTOpen:

SBMJOB CMD(QSH CMD('for input in $(find /jtopen_3_0/lib 

-name ''*.jar''); do system "CRTJVAPGM CLSF(''"$input"'') 
 OPTIMIZE(40)"; done')) JOB(JTOPEN) JOBQ(QSYSNOMAX)

Compiling the JTOpen JAR files using optimization level 40 cut the run time on one program that I am working on from 30 seconds to eight seconds.

-- David

Sponsored By
WORKSRIGHT SOFTWARE, INC.

CASS Certification

What is it?

Why do you need it?

CASS stands for Coding Accuracy Support System. This is a test developed by the US Postal Service to determine whether ZIP Code software can accurately assign ZIP Codes to mailing addresses. CASS-certified software is intended to improve the accuracy of carrier route, 5-digit ZIP, ZIP+4, and delivery point codes.

CASS certified means the software has passed the test. When you use CASS software to update and maintain your mailing file, your mailing file becomes CASS certified. What does this mean to you?

CASS certification is the first step in qualifying for postage discounts. Look at the mail you receive at home and at work; you will see that a lot of it was mailed for less than the regular 34-cent rate.

If your company sends out a lot of mail, there is a good chance CASS certification can cut your postage expense. There are other steps you must perform to get these discounts, but CASS is the first step.

Exactly what happens when you process your mailing files with CASS software? The software breaks the address down into its individual elements: state, city, street name, and so forth. Then the information is compared to the national ZIP+4 database. If a match is found, the ZIP Code, ZIP+4, delivery point, and carrier route are assigned. Also the delivery line is standardized to comply with Postal Service preferences.

If an address can't be matched, no action is taken. This has the positive effect of allowing you to identify addresses in your mailing files which possibly can't be delivered, will be delayed in delivery, or at the very minimum need some minor correction to one of the address elements.

Using CASS certified software has many side benefits. You will be able to identify addresses that are potentially undeliverable. It has been estimated that as much as 30 percent of all advertising mail is never delivered.

That means the costs of postage, printing, paper, and overhead for the undelivered mail are wasted. If you spend $100,000 on a direct mail campaign, as much as $30,000 could be completely wasted.

CASS software provides a number of intangible benefits. With CASS certification and barcoding there is a good likelihood that that your mail will be delivered sooner. If your invoices are delivered one day sooner, you may receive payment one day sooner.

The bottom line is that using CASS software will help you keep your customers' address information in much better shape than they would be otherwise. Your mail may be delivered sooner at less cost, and that means more bottom-line dollars for your company.

If you would like more information about CASS and CASS software visit our Web site or contact WorksRight Software, Inc. at 601-856-8337.

THIS ISSUE
SPONSORED BY:
WorksRight Software, Inc.
TRAMENCO
BACK ISSUES
TABLE OF CONTENTS
Avoiding a Sign-On with Java
CLRPFM for the IFS
Reader Feedback and Insights: Ad-Hoc SQL and Linux
  Newsletters | Subscribe | Advertise | About Us | Contact | Search | Home  
  Last Updated: 4/10/02
Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.