Creating an OHIO Implementation

What is OHIO?

OHIO stands for Open Host Interface Objects. It is a standard API for interacting with mainframe (host) screens.

Creating an OHIO Implementation

Here are some of the steps I went through to build an OHIO Implementation.

  1. I looked up the OHIO Interface Definition from the IETF. All of the Java interfaces in my ca.intelliware.ohio package are taken directly from this specification.
  2. I also have a copy of TCP Viewer on my laptop. This tool allows me to proxy a remote port and view the messages being exchanged. With TCP Viewer, I was able to capture some messages between a TN3270 client and the mainframe.
  3. I interpreted the messages using the IBM 3270 Data Stream Programmer’s Guide and the basic Telnet specification. It’s important to understand that the TN3270 protocol is basically 3270 data streams exchanged over Telnet.
  4. I built a MockServer that can playback these messages to the client. Most of my testing has been with this mock server.
  5. I additionally downloaded a copy of Apache’s Jakarta Commons Net component which provides an implementation of Telnet.

Telnet Negotiation

The basic set of interchanges work like this:

  1. The client opens a socket with the server.
  2. The server asks, the client, “Do you do TN3270E?”
  3. The client says, “Nope” (right now, I’m only supporting TN3270 without the E)
  4. The server asks, “Do you mind if I ask you what kind of terminal you are?”
  5. The client says, “No, I don’t mind.”
  6. The server asks, “What kind of terminal are you?”
  7. The client says, “I’m an IBM-3278-2-E” (this E shouldn’t be confused with the E in TN3270E)
  8. The server says, “Well, if we’re going to talk, then, let’s talk binary (because I want to send you EBCDIC codes) and I want to use ‘block mode/record mode’. I’ll end all future messages with a special Telnet End-of-Record”
  9. The client says, “Binary? Sure thing! EOR? Sure thing!”
  10. The server now sends some messages saying, basically, “Describe your extended terminal capabilities. Over (EOR).”
  11. The client says, “I support lots of things: colours, highlighting, yada yada. Over.”
  12. The server then starts sending the 3270 data stream to describe the first screen.

What Does that Look Like?

Here’s an example of how that looks in TCP Viewer:

252: Client connected; 127.0.0.1:2408
252: Connecting to Server
252: Connected to Server
252: Server to Client (3 bytes)
0000  FF FD 28                                          ..(
252: Client to Server (3 bytes)
0000  FF FC 28                                          ..(
252: Server to Client (3 bytes)
0000  FF FD 18                                          ...
252: Client to Server (3 bytes)
0000  FF FB 18                                          ...
252: Server to Client (6 bytes)
0000  FF FA 18 01 FF F0                                 ......
252: Client to Server (18 bytes)
0000  FF FA 18 00 49 42 4D 2D  33 32 37 38 2D 32 2D 45  ....IBM-3278-2-E
0010  FF F0                                             ..
252: Server to Client (12 bytes)
0000  FF FD 19 FF FB 19 FF FD  00 FF FB 00              ............
252: Client to Server (12 bytes)
0000  FF FB 19 FF FD 19 FF FB  00 FF FD 00              ............
252: Server to Client (15 bytes)
0000  11 00 06 40 00 F1 82 00  05 01 FF FF 02 FF EF     ...@...........
252: Client to Server (145 bytes)
0000  88 00 0D 81 80 80 81 85  86 87 88 8A 95 A6 00 17  ................
0010  81 81 01 00 00 50 00 18  01 FF FF FF FF FF FF FF  .....P..........
0020  FF FF FF FF FF FF FF FF  FF 05 0C 07 80 00 14 81  ................
0030  85 02 00 00 00 00 00 00  00 07 00 00 00 02 B9 00  ................
0040  25 00 16 81 86 01 08 00  F4 F1 F1 F2 F2 F3 F3 F4  %...............
0050  F4 F5 F5 F6 F6 F7 F7 00  0F 81 87 05 00 F0 F1 F1  ................
0060  F2 F2 F4 F4 F8 F8 00 07  81 88 00 01 02 00 05 81  ................
0070  8A 06 00 0C 81 95 00 00  08 00 08 00 01 01 00 11  ................
0080  81 A6 00 00 0B 01 00 00  50 00 18 00 50 00 18 FF  ........P...P...
0090  EF                                                .
252: Server to Client (1475 bytes)
0000  05 C2 11 00 00 1D F0 11  00 4F 1D F0 1D 60 11 00  .........O...`..
0010  blah blah blah

EBCDIC to ASCII Translation

I translate all EBCDIC values based on an assumption that the host is using EBCDIC Codepage 037. All codes from 0x40 to 0xFE are translated into unique ASCII characters (bidirectionally). Bytes outside of that range are treated as spaces. This also means that any ASCII values that can’t be mapped to an EBCDIC value from 0x40 to 0xFE will be sent to the host as a space.

Object Model

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply