Skip to main content

3. Data Stream Format

The actual data stream that is exchanged between the client and server is composed of a header followed by the 5250 work station data stream. For information about the 5250 work station data stream refer to the IBM 5250 Information Display System, Functions Reference Manual (SA21-9247). The header which prefixes the 5250 data stream was originally designed for the 5250 Display Station Pass-Through (DSPT) application. 5250 DSPT is an application similar to Telnet which runs on the IBM AS/400, System/36, and System/38 over an SNA network. This header is designed to be variable in length and is composed of two parts. The first, fixed part is always 6 octets long and has the following format:

 0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Logical Record Length | Record Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Logical Record Length: 16 bits

This field indicates the length, in octets, of this logical record including the header length. The length is calculated BEFORE doubling any IAC characters in the data stream. The length does not include the that is appended to the end of the data stream to mark the end of this logical record. The length is specified with the most significant octet first. For example, a length of 36 (decimal) would be specified as '0024'X.

Record Type: 16 bits

This field indicates the SNA record type. It should always be set to '12A0'X to indicate the General Data Stream (GDS) record type.

Reserved: 16 bits

This field is currently not used.

The second part of the header is designed to be variable in length. The length of this variable part is specified in the first octet. Currently this portion of the header will always be 4 octets long and has the following format:

 0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |E|A| | | |S|T|H| | |
| Var Hdr Len |R|T| | | |R|R|L| | Opcode |
| |R|N| | | |Q|Q|P| | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Var Hdr Len: 8 bits

The length, in octets, of the variable portion of the header. Currently this is always '04'X.

Flags: 16 bits

Bit 0:      ERR     This bit is set to indicate a data stream
output error. The negative response code
is sent as data following the opcode field.
Bit 1: ATN This bit is set to indicate that the 5250
attention key was pressed.
Bits 2-4: * These bits are reserved (set to zero).
Bit 5: SRQ This bit is set to indicate that the 5250
System Request key was pressed.
Bit 6: TRQ This bit is set to indicate that the 5250
Test Request key was pressed.
Bit 7: HLP This bit is set to indicate the Help in
Error State function. The error code is
sent as data following the header and is
a four digit packed decimal number. For
example, an error code of '0005'X indicates
the operator attempted to type in an area of
the display that is not enabled for input.
Bits 8-15: * These bits are reserved (set to zero).

Opcode: 8 bits

This field contains the operation code. It is set to indicate the type of operation requested by the sender. The following are the valid values:

'00'X:  No Operation
'01'X: Invite Operation
'02'X: Output Only
'03'X: Put/Get Operation
'04'X: Save Screen Operation
'05'X: Restore Screen Operation
'06'X: Read Immediate Operation
'07'X: Reserved
'08'X: Read Screen Operation
'09'X: Reserved
'0A'X: Cancel Invite Operation
'0B'X: Turn On Message Light
'0C'X: Turn Off Message Light

The actual 5250 work station data stream will immediately follow the opcode field in the header and will be terminated by the pair. For some operations the header will be immediately followed by an without any 5250 work station data stream in between. For example, the following request to turn on the message light could be sent by the server:

000A 12A0 0000 0400 000B FFEF
| | | | | | |
| | | | | | End Of Record marker
| | | | | |
| | | | | Opcode = Turn On Message Light ('0B'X)
| | | | |
| | | | Flags = '0000'X
| | | |
| | | Variable Header Length = '04'X
| | |
| | Reserved - Set to '0000'X
| |
| Record Type = General Data Stream ('12A0'X)
|
Logical Record Length = '000A'X for this record

In this example the requested operation is indicated by the opcode and there is no associated work station data stream.