NonStop Server for Java (NSJ) Programmer's Guide (NSJ 2.0+)

DDL definition:
DEF nationalChars.
02 ascii-field pic x(10).
02 kanji-field1 pic n(20).
02 kanji-field2 pic n(40).
end
If you want to use encoding for the class generated for this DEF, you could invoke ddl2java by specifying:
ddl2java -e mycode.encoding .....
When you execute the java application that uses the generated class, you could indicate that Kanji is the default encoding by
invoking java as follows:
java -Dmycode.encoding=SJIS myprog
In this example,
mycode.encoding
is the key to the coding property that you specified when you invoked ddl2java
SJIS
indicates that you want to use Kanji as the default encoding.
ddl2java also allows you to specify that you want a specific field to be encoded with a value different from the default
encoding value. In the DDL described previously, you might want the ascii-field to be encoded as ASCII while the
other fields are encoded as SJIS. To indicate this, you specify the following on the command line to java:
java -Dmycode.encoding=SJIS -Dascii_field=ASCII ...
When you want a specific field to be encoded with a value other than the default encoding, you specify the name of the
instance variable associated with that field as the System property key. Be aware that ddl2java might create a qualified
name for an instance variable, so be sure to use the instance variable name as specified in the generated class.
Communicating With Pathway Servers
To communicate with a Pathway server from Java, follow these steps:
Create classes for requests and replies.1.
Use the setXXX() methods of the generated TsmpServerRequest class to supply the data to be sent to the
Pathway server.
2.
Instantiate a TsmpServer. This object represents a session with a particular Pathway server class.3.
Call the service() method of the TsmpServer object to send the request to the Pathway server.4.
Call the getXXX() methods of the generated TsmpServerReply class to cause the reply to read the reply
information.
5.
Note: When using transactions with Pathway servers, you must explicitly begin and end them. Typically, you
begin the transaction before sending a request and end the transaction after receiving the reply. For instructions
on managing transactions within Java programs, see Transactions.
Creating Classes for Requests and Replies
You must create classes for every request and reply that the Pathway server uses. To do this, use a Data Definition
Language (DDL) dictionary and the ddl2java and javadoc tools as follows:
Create an item list file that describes the items in the DDL dictionary for which you want to generate reply and request
classes. Each request and each reply must contain exactly one data description.
1.
Supply the location of the DDL dictionary and the item list file as input to the ddl2java tool.2.