Formatting Messages in Java to Communicate with Legacy Systems, Part 2

We conclude this tutorial with with more on the BuildMsg.processRequest() and BuildMsg.getMsg() methods, and generating an EBCDIC byte stream using "cp500" encoding.

provided by: 
Originally published at Internet.com


Introduction



In Part 1 of our tutorial, we began discussing how legacy systems usually expect messages in a rigid format, such as EBCDIC (Extended Binary Coded Decimal Interchange Code), and how such messages can be built in Java. Here in Part 2, we'll continue this discussion, with more detail on the BuildMsg.processRequest() and BuildMsg.getMsg() methods, and generating an EBCDIC byte stream using "cp500" encoding.

BuildMsg Class



The BuildMsg class has two critical methods namely processRequest() and getMsg(). The processRequest method constructs the message. The getMsg method returns the message as an EBCDIC byte array.
BuildMsg.processRequest() method


The processRequest method accepts a parameter of the type InputData and uses it to construct the message. The testMsg StringBuffer will hold the message that is built. The set methods for each data item return a string that is appended to the testMsg StringBuffer.

The set methods for each data item (like setDi1 ) will take care of the details of setting up that particular data item. They will also set a flag to indicate whether the data item exists. These flags are used by the method inpDiDefine.setPBitmapFromFlags() to set the bitmap. The bitmap for the message is built dynamically for every message based on the flags...

Read article at Internet.com site
Regional Articles
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Alabama
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Alaska
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Arizona
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Arkansas
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 California
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Colorado
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Connecticut
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 DC
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Delaware
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Florida
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Georgia
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Hawaii
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Idaho
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Illinois
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Indiana
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Iowa
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Kansas
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Kentucky
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Louisiana
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Maine
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Maryland
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Massachusetts
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Michigan
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Minnesota
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Mississippi
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Missouri
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Montana
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Nebraska
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Nevada
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 New Hampshire
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 New Jersey
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 New Mexico
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 New York
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 North Carolina
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 North Dakota
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Ohio
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Oklahoma
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Oregon
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Pennsylvania
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Rhode Island
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 South Carolina
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 South Dakota
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Tennessee
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Texas
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Utah
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Vermont
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Virginia
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Washington
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 West Virginia
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Wisconsin
- Formatting Messages in Java to Communicate with Legacy Systems, Part 2 Wyoming

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML