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

Definition EMPLOYEE-RP.
02 replyCode Pic 99.
02 replyMessage Pic X(30).
End
1. Create an item list file.
For the preceding request and reply data, the item list file might look like this:
DEF employee-def,RQ,C,NT
DEF employee-rp,RP,C,NT
The first line of the item list file means "Look for a DDL definition (DEF) (as opposed to a DDL record) named
employee-def and generate a request (RQ) class from this definition."
The second line of the item list file means "Look for a DDL definition named employee-rp and generate a reply (RP)
class from this definition."
In both lines, C means that the Pathway server is written in C (as opposed to COBOL) and NT means that the server expects
null-terminated (rather than non-null-terminated) strings.
2. Use ddl2java to create the Java source files.
Assume that the DDL dictionary resides on $foo.dict, the item list file's name is itemlist, you want to create a
package called empinfo, and you want ddl2java to create the Java source files in the directory empinfo_src. Run
ddl2java as follows:
ddl2java -dpath /G/foo/dict -i itemlist -p empinfo -c -d empinfo_src
The ddl2java tool generates the following files:
Java Source Files Compiled Class Files
For Request
./empinfo_src/RQEmployee_def.java ./empinfo/RQEmployee_def.class
For Reply
./empinfo_src/RPEmployee_rp.java ./empinfo/RPEmployee_rp.class
RQEmployee_def extends the abstract class TsmpServerRequest and RPEmployee_rp extends the abstract class
TsmpServerReply. These abstract classes are part of the com.tandem.tsmp package.
3. Use javadoc to create reference pages for the new classes.
javadoc RQEmployee_def.java RPEmployee_def.java
4. Use the reference pages to learn which methods to call to set up request data and read the server's
reply.
For more information about the ddl2java tool, see the NonStop
TM
Server for Java Tools Reference Pages.
Setting Up Request Data
Use the setXXX() methods of the request class generated by ddl2java to supply the request data. Supply each data item
as a Java String. The TsmpServer that you create to communicate with the server will automatically call a data
conversion method in the generated request class to convert the data to the format that the server expects.
Continuing the example from the preceding section, set up a request to retrieve data about an employee named Vipin Gupta
like this:
RQEmployee_def myRequest = new RQEmployee_def();
myRequest.setFirst(Vipin);