For the ECRTP Java API on a PC, we are now providing the JAVA class (RTP.class) and the wrapper DLL (callrtp.dll) rather than the source code. Before using your Java API with your map, you need to follow these steps.
At your classpath, extract the javartp.jar (i.e. jar xf javartp.jar).
Copy callrtp.dll and owrm32c.dll from %classpath%\com\sybase\vn\lib directory to your PATH directory. You can add a PATH directory (c:\lib, for example) through your System Properties, Advanced Tab.
Check and modify the drive letter in the demo files to point to the hard drive where your map files are located.
Use the provided demo files (demo1.bat, demo2.bat, etc.) and their referenced sample maps to test with your ECRTP Java API before you try to run your own maps.
Modify DEMOAPP.java or build your own application with ECRTP Java API and reference the maps you want to run.
Following is a table of the error codes for the wrapper DLL:
Error code |
Description |
---|---|
100 |
An exception occurred when calling the API for ECRTP. This indicates that something may be wrong in your OWRM32C.DLL. For example, the version may be incorrect. |
101 |
An exception occurred before the API for ECRTP was called. Exceptions other than 103-109 will be caught by this. |
102 |
An exception occurred after the API for ECRTP was called. Exceptions other than 103-109 will be caught by this. |
103 |
The incorrect number of elements were entered in a string array. |
104 |
An exception occurred when the UTF character strings were released. |
105 |
An exception occurred when getting the string array elements. System resource problem. |
106 |
An exception occurred when a memory I/O structure pointer array was allocated. System resources problem. |
107 |
An exception occurred when the memory I/O structure pointer for memory files was initialized. System resources problem. |
108 |
An exception occurred when the output was set. System resource problem. |
109 |
An exception occurred when deleting memiostruct elements. |
Below is the sample code for DEMOAPP.java.
/*
DEMOAPP.java
This Java Program demonstrates how to use RTP Java Class(RTP.class).
There are 4 API functions provided by RTP Java Class.
1. int JINBOUNDRunCmd(String Str);
2. int JOUTBOUNDRunCmd(String Str);
3. int JINRun(String[] strarr);
4. int JOUTRun(String[] strarr);
The 3rd and 4th functions call Memory I/O functions. The parameter of these two functions is a string array. The very first element of the string array is the command line switches for running the map. The following elements are grouped by two elements. the first one is the file name that will be substituted with a memory file. The second one will be the data of the memory file. If the memory file is an input file, put the input data in this string. If the memory file is an output file, use an empty string to indicate it. Multiple input/output memory files can be specified in this string array.
DEMOAPP Class contains 4 cases that use each of the 4 RTP Java API functions. Each case is called by a separate batch file that is below after this listing.
Case 1: Run an inbound map, pass the command switches as the parameter.
Case 2: Run an outbound map, pass the command switches as the parameter.
Case 3: Run an inbound map with Memory I/O, pass a string array as the parameter.
Case 4: Run an outbound map with Memory I/O, pass a string array as the parameter.
*/
package com.sybase.vn.demo;
import com.sybase.vn.javartp.RTP;
public class DEMOAPP
{
public static void main(String[] args)
{
int ret;
// Declare and initialize the RTP Java Class.
RTP myrtp;
try
{
myrtp = new RTP();
}
catch(Throwable t)
{
System.err.println("Exception caught: " + t.getMessage());
return;
}
// Convert the first argument as the case number.
Integer num = Integer.valueOf(args[0]);
switch (num.intValue()) {
case 1:
System.out.println("one");
System.out.println("args[1] = " + args[1]);
// Run an inbound map, pass the command switches as the parameter.
ret = myrtp.JINBOUNDRunCmd(args[1]);
System.out.println("ret = " + ret);
break;
case 2:
System.out.println("two");
System.out.println("args[1] = " + args[1]);
// Run an outbound map, pass the command switches as the parameter.
ret = myrtp.JOUTBOUNDRunCmd(args[1]);
System.out.println("ret = " + ret);
break;
case 3:
System.out.println("three");
// Prepare the string array as the JINRun() parameter to run 271in map.
String[] strarr_inrun =
{
// Command line switches for 271in map. "d:\\classes\\com\\sybase\\vn\\maps\\271in\\271gdtst.t xt -dg d:\\classes\\com\\sybase\\vn\\maps\\271in -dt d:\\classes\\com\\sybase\\vn\\maps\\271in -du d:\\classes\\com\\sybase\\vn\\maps\\271in -xl -l -it -o -wx 1 -n -w -b -m 271IN -mx 2",
// Input file name to be substituted with memory buffer.
"d:\\classes\\com\\sybase\\vn\\maps\\ 271in\\271gdtst.txt",
// Input data of 271in map.
"ISA*00* *00* *01*9012345720000
*01*9088877320000 *001030*1030*U*00401*000000001*0*T*:!\n" +
"GS*HB*901234572000*908887732000*20001030*1615*1*X*004010X092!\n" +
"ST*271*0001!\n" +
"BHT*0022*11*3920394930203*20001030*1615!\n" +
"HL*1**20*1!\n" +
"NM1*PR*2*BLUE CROSS BLUE SHIELD*****PI*9012345918341!\n" +
"PER*IC*ARTHUR JONES*TE*6145551212*FX*6145551214!\n" +
"HL*2*1*21*1!\n" + "NM1*1P*1*JOHNSON*BARBARA****SV*223447582752!\n" +
"REF*1J*500!\n" +
"HL*3*2*22*1!\n" +
"TRN*2*12345678900987654321768958473*1311234567*500!\n" +
"NM1*IL*1*DAVIS*SAM*T***MI*223344!\n" +
"REF*18*223453424!\n" +
"N3*PO BOX 123!\n" +
"N4*CINCINNATI*OH*43017*US!\n" +
"PER*IC**HP*6147562231*WP*6145221212!\n" +
"DMG*D8*19720513*F!\n" +
"INS*Y*18*******F*N!\n" +
"DTP*102*D8*001030!\n" +
"EB*1*CHD*1*GP**6*100.00****N*N!\n" +
"HSD*DY*100*DA*163395*6*100*1*A!\n" +
"REF*18*4654746868565!\n" +
"DTP*193*D8*001030!\n" +
"III*BF*11!\n" +
"LS*2120!\n" +
"NM1*13*1*SMITH*MUFFY****24*111222333!\n" +
"N3*157 WEST 57TH STREET!\n" +
"N4*COLUMBUS*OH*43017*US!\n" +
"PER*IC*MAGGIE MCGILLICUTTY*TE*6145551245!\n" +
"PRV*AT*9K*3920394930203!\n" +
"LE*2120!\n" +
"SE*31*0001!\n" +
"GE*1*1!\n" +
"IEA*1*000000001!\n",
// Output file name.
"d:\\classes\\com\\sybase\\vn\\maps\\ 271in\\dbo_EL_ENVOY",
// An empty string that indicates the previous
// file name is substituted with output memory file.
""
};
// Run an inbound map with Memory I/O, pass a string array as the parameter.
ret = myrtp.JINRun(strarr_inrun);
System.out.println("ret = " + ret);
System.out.println("strarr_inrun[4] = " + strarr_inrun[4]);
break;
case 4:
System.out.println("four");
// Prepare the string array as the JOUTRun() parameter to run 270out map.
String[] strarr_outrun =
{
// Command line switches for 270out map.
"d:\\classes\\com\\sybase\\vn\\maps\\270out\\270out.x12 270OUT HS -t 270 -xl -dg
d:\\classes\\com\\sybase\\vn\\maps\\270out -dt
d:\\classes\\com\\sybase\\vn\\maps\\270out -du
d:\\classes\\com\\sybase\\vn\\maps\\270out -xl -l -it -o -wx 1 -mx 2",
// Input file name to be substituted with memory buffer.
"d:\\classes\\com\\sybase\\vn\\maps
\\270out\\dbo_EL_ENVOY",
// Input data of 270out map.
"0394930203 SAM
DAVIS PO BOX 123
CINCINNATI OH
43017 19720513 F223344
1 100BLUE CROSS BLUE SHIELD 9012345918341
JOHNSON 223447582752
AT SMITH
\n",
// Output file name.
"d:\\classes\\com\\sybase\\vn\\maps\\270out\\270out.x12",
// An empty string that indicates the previous file.
// name is substituted with output memory file.
""
};
// Run an outbound map with Memory I/O, pass a
// string array as the parameter.
ret = myrtp.JOUTRun(strarr_outrun);
System.out.println("ret = " + ret);
System.out.println("strarr_outrun[4] = " + strarr_outrun[4]);
break;
default:
System.out.println("Invalid option!");
break;
}
}
}
Below is the contents of demo1.bat, which runs an inbound map and passes the command switches as the parameters.
REM demo1.batjava com.sybase.vn.demo.DEMOAPP 1
"d:\\classes\\com\\sybase\\vn\\maps\\271in\\271gdtst.txt -dg
d:\\classes\\com\\sybase\\vn\\maps\\271in -dt
d:\\classes\\com\\sybase\\vn\\maps\\271in -du
d:\\classes\\com\\sybase\\vn\\maps\\271in -xl -l -it -o -wx 1 -n -w -b -m
271IN -mx 2"
pause
Below is the contents of demo2.bat, which runs an outbound map and passes the command switches as the parameters.
REM demo2.batjava com.sybase.vn.demo.DEMOAPP 2
"d:\\classes\\com\\sybase\\vn\\maps\\270out\\270out.x12 270OUT HS -t 270 -xl -dg
d:\\classes\\com\\sybase\\vn\\maps\\270out -dt
d:\\classes\\com\\sybase\\vn\\maps\\270out -du
d:\\classes\\com\\sybase\\vn\\maps\\270out -xl -l -it -o -wx 1 -mx 2"
pause
Below is the contents of demo3.bat, which runs an inbound map with Memory I/O and passes a string array as a parameter.
REM demo3.batjava com.sybase.vn.demo.DEMOAPP 3pause
Below is the contents of demo4.bat, which runs an outbound map with Memory I/O and passes a string array as a parameter.
REM demo4.bat
java com.sybase.vn.demo.DEMOAPP 4
pause