provided by: 
Originally published at Internet.comIntroduction
A lot of new applications are being written today in Java. Companies also have a vested interest in maintaining their legacy systems. So there is a need for Java applications to communicate with legacy systems through messages that those systems can interpret properly.
This article discusses some of the issues involved in formatting messages to be sent to a legacy system. The legacy system usually expects its messages in a rigid format. We will illustrate how such a message can be built in Java. And we will also show how to construct a byte stream in EBCDIC (Extended Binary Coded Decimal Interchange Code) format in a Java application.
I work on a Java application that uses sockets to communicate with the legacy system. Two threads exist, one to write to the legacy system and another to read messages from it. This document is not intended to discuss the architecture. The focus is on building the message that needs to be sent.
The message format:
Here is a sample message format that we will use in this document. Note that this is just a hypothetical message and the goal here is to study how to construct the message.
Bitmap (16 bytes) : 11110000 00000000 Data Item 1 : 6 digit integer Data Item 2 : ... ... ... Data Item 15 : .... Data Item 16 : ......
Read article at Internet.com site