CPI-C for Java

One Internet technology that has generated much attention lately is Java;, a network-enabled computing environment developed by Sun Microsystems;. Java is a useful technology for two reasons:

  1. It is platform-independent, so applications can be written once and run on a variety of computers.
  2. It can be dynamically downloaded; that is, code can reside on a server and flow to the client as needed, thus reducing client installation costs.

IBM created a Java binding to Common Programming Interface for Communications (CPI-C), an open API for SNA LU 6.2. This improves the suitability of Java for highly reliable enterprise intranets.

The CPI-C for Java toolkit provides:

  • The ability to write a CPI-C for Java application once and run the application on any platform that supports CPI-C for Java
  • The ability to port client-side applications to CPI-C for Java and run with existing APPC and CPI-C server applications without any change to the server application
  • The ability to leverage your existing CPI-C programming skills in this new Java world

JPing Sample Program

JPing is a sample CPI-C Java application which behaves similarly to the ASUITE "APING" client application. JPing will exchange data with an APING Server process (APINGD) running either on the gateway or a workstation. JPing is run from a command line, and its operation is controlled by the command-line arguments it is given when started.

The class file JPing.class is included in the Java Archive (JAR) file CPICJAVA.JAR. When running the sample, you must tell the Java Runtime Environment (JRE) where to search for the class file. The following examples assume that Personal Communications was installed in C:\Program Files\Personal Communications. The JRE is installed in the JRE subdirectory, and the JAR file is in the samples\JPing subdirectory.

The first example runs JPing with the -? option to display a usage message.

C:\Program Files\Personal Communications>jre\bin\jre -cp .\CPICJAVA.JAR JPing -?

Copyright IBM Corporation 1997. All rights reserved.
U.S. Government Users Restricted Rights - Use, duplication
or disclosure restricted by GSA ADP Schedule Contract with
IBM Corp.

JPing [-s symb_dest] [-n num_iter] [-d data_len]

The "-cp .\CPICJAVA.JAR" option is given to the JRE to indicate that the search for classes should include CPICJAVA.JAR in addition to the default places and the CLASSPATH environment variable.

The next example assumes the user has a CPI-C side info record "APINGM4" configured.
This example runs JPing with the -s APINGM4 CPI-C symbolic destination name for 10 iterations:

C:\Program Files\Personal Communications>jre\bin\jre -cp .\CPICJAVA.JAR JPing -s APINGM4 -n 10

-----------------JPing Opening------------------
          OS Name      = Windows 95
  CPI-C Side Info (-s) = APINGM4
Number Iterations (-n) = 10
      Data Length (-d) = 2000
   Max Buffer (cmembs) = 65535

Allocate Time = 0.05 seconds

Version Exchange Time = 0.66 seconds

Server Error Version: 1
ServerVersion: 2.38

Ping Time = 0.11 seconds
Ping Time = 0.05 seconds
Ping Time = 0.11 seconds
Ping Time = 0.06 seconds
Ping Time = 0.05 seconds
Ping Time = 0.11 seconds
Ping Time = 0.06 seconds
Ping Time = 0.05 seconds
Ping Time = 0.06 seconds
Ping Time = 0.11 seconds

Total Ping Time = 0.77
Average Ping Time = 0.077
-----------------JPing Closing------------------

See Quick Beginnings and Configuration File Reference for information on how to configure CPI-C Side Information records for APING and JPing. The supplied sample currently cannot use a Control Point name as the partner LU name, but you can easily modify it to do so.


IBM, eNetwork, and OS/2 are trademarks of International Business Machines Corporation in the United States and/or other countries.
Java is a trademark of Sun Microsystems, Inc.
Windows 95 is a trademark or registered trademark of Microsoft Corporation.
Other company, product, and service names may be trademarks or service marks of others.


Navigation

[Top of Page] [IBM eNetwork Personal Communications homepage]


[IBM Homepage] [Contact IBM]