| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Address Validation

Page history last edited by PBworks 16 years, 10 months ago

Demonstrates:

a) Use of JNI techniques to call Java code from RPG IV: ADDRSUBMIT RPG module, JVM RPG module, STARTJVM1 RPG module, STARTJVM CL program, STRADDVAL CL program

b) Use of RPG IV pointers: ADDRESSDSP RPG module

c) Use of iSeries Toolbox record-level classes to provide Java external descriptions: JAVACLASS CL program, CreateJavaExternalDescription Java source

d) Use of SAAJ open source classes to invoke Web services: AddressValidation Java source

 

Brief details of the setup follow.

 

This functionality provides validation of the address entered and/or a database of close matches from which will be displayed on the iSeries screen and from which the user can select the selected / validated address, which will then include Longitude/Latitude information. The process needs to be so efficient that the user is not aware that the validation process has interacted with another system.

 

This code provides a proof of concept for the above.

 

iSeries library ADDRESSPOC

 

ADDRESSDSP DSPF / RPG – proof of concept test harness - see comments at top of RPG code for compilation and CRTPGM parameters.

 

 

ADDRSUBMIT RPG – invokes Java processing to submit address validation request and to parse and return array of address alternatives.

 

 

ADDRESS PF – external description of address alternative (each ADDRSUBMIT address alternative array element is one of these).

 

 

JAVACLASS CLP – general purpose code used to generate and compile Java external description class ADDRESSRFormat (see below).

 

STRADDVAL CMD / CLP – starts Java Virtual Machine in current job with correct java.endorsed.dirs setting, correct Java version (1.4.2) and correct classpath. Also sets current directory to /Sun/AddressValidation. Essential that STRADDVAL is called before any Java processing is done, since SAAJ will not work with JDK 1.4.2 unless java.endorsed.dirs is set correctly. STRADDVAL need only be done once per signon session. You will only need to change STRADDVAL if you change the list of necessary jar files.

 

 

STARTJVM CMD / CLP – general purpose code called by the above.

 

 

STARTJVM1 RPG – called by STARTJVM, invokes standard IBM-supplied JVM processing (in module JVM) to start Java Virtual Machine with correct settings. Compile via CRTRPGMOD DBGVIEW(*SOURCE) and bind with module JVM via CRTPGM.

 

 

JVM / JVMPROTO RPG – IBM-supplied JVM processing and related prototypes.

 

iSeries IFS stuff in /Sun directory

 

/Sun/jwsdp-1.6 - various SAAJ and XML processing jar files from the JWSDP 1.6 and Xerces open source projects (see STRADDVAL CLP for list). All must be optimised to level 40 (CRTJVAPGM /xxx/yyy.jar OPTIMIZE(40)) when installed or re-installed on any iSeries system – absolutely essential for perfomance. This takes a long time – if you need to do it, run it overnight in batch. However I don’t anticipate any changes being necessary to this part of the deployment. STRADDVAL puts all these jars in the classpath.

 

 

/Sun/AddressValidation - new Java class AddressValidation.java which sets up and invokes the Geocoder51 Web service call and then parses the results, storing them one by one in ADDRSUBMIT’s address alternative array. Data is converted between Java and RPG formats by Java class ADDRESSRFormat, which is generated and compiled automatically via CALL JAVACLASS (ADDRESS ADDRESSPOC ADDRESSR). Do not forget to re-run JAVACLASS if you change the ADDRESS external description. ADDRESSRFormat is stored in /Sun/AddressValidation/com.xml. ESSENTIAL - both AddressValidation and ADDRESSRFormat must be optimised to level 40 whenever a new version is deployed. ADDRESSRFormat requires the Java Toolbox which is available in ready optimised form at /QIBM/ProdData/java400/jt400ntv.jar. You will see that STRADDVAL puts this in the classpath. Also note the slightly wacky mechanism by which the array gets back into ADDRSUBMIT, one byte at a time. We can’t simply pass the whole thing back as a parameter because OS/400, in its infinite wisdom, tries to convert it from ASCII to EBCDIC if you do that, and the Toolbox has effectively already converted it to EBCDIC.

 

 

When compiling AddressValidation.java you need /QIBM/ProdData/java400/jt400ntv.jar and /Sun/jwsdp-1.6/saaj/lib/saaj-api.jar in the classpath, none of the others is required at compile time. You are advised to do the Java compiling (javac) from qsh on the iSeries for simplicity (and, again, don’t forget to optimise the results!) 

Comments (0)

You don't have permission to comment on this page.