3270 is a generic name for a range of display products first announced by IBM in 1971. 3270 data stream is the protocol used between the display system control unit and a host computer, it is independent of the line protocol and so can be carried over a BSC link or a SNA network. The 3270 data stream has control codes embedded in it to format the data and control text going from the host computer to the 3270 screen and text read from the 3270 keyboard to the host computer. An extended data stream was defined in 1979 to support additional features such as colour.
1 - BSC 3270 related protocols
Host Terminal
Protocol PSS Protocol
Convertor ............... Convertor
Host ---------- . . ---------
Computer | | . . | | 3270
------- | | . . | | ---------
| | | | . . | | | |
| | | | . . | | | |
|HOST +-| PAD +----. PACKET .-----| PAD +---| CU |
| | | | . SWITCHING . | | | |
+-------| +----------| ................. +---------| +---------|
|
| --
+-| \--
| +-----|
| --
+-| \--
| +-----|
| --
+-| \--
+-----|
<---------------- 3270 data stream ------------------------>
<----DSP -------------------------->
<-- BSC ---><----X.25 -------------------------><-- BSC -->
I have further information on the following,
IBM-BSC.TXT Binary Synchronous Communications
IBM-DSP.TXT Display System Protocol
IBM-DS.TXT 3270 Datastream
IBM-SNA.TXT Systems network Architecture
IBM-GTE.TXT Telenet 3010 PAD
IBM-PAR.TXT Telenet 3010 Parameters
IBM-TRI.TXT Information on the 3270 BSC Trial
IBM-PLAN.TXT Information on BT use of IBM protocols
2 - 3270 DATA STREAM - INTRODUCTION
`3270 Data Stream' is the term used to describe the device control protocol
usd between an IBM host computer and an IBM 3270 control unit - (3271, 3272,
3274, 3275 or 3276) - to exchange user or control data, to or from displays
or printer attached to the control unit, and application programs executing
in the host. 3270 Data Stream consists of user data, commands to initiate data
transfer operations, orders to `control' and modify the representation of the
data, a buffer addressing scheme to denote the location of user and control
data within the display or printer presentation space and control fields to
convey control or status information.
3270 Data Stream is data-link protocol independent, ie the same data stream
is used by local (channel attached) and remote (SDLC or BSC, line attached)
control units, and it supports both EBCDIC and ASCII character coding schemes.
3270 Data Stream does not deal with link-level control unit addressing of
displays and printers relative to a control unit. This addressing is performed
by a combination of SNA addressing and data-link control protocol-defined addressing
schemes:
- Local, non-SNA: each display and printer is addressed via its designated subchannel address
- Local, SNA: the control unit is identified by a subchannel address and displays and printers addressed via their SNA local addresses
- Remote, SDLC: the control unit is identified by a control unit address specified in the SDLC frame's address field and the displays and printers addressed via their SNA local addresses
- Remote, BSC: control unit and the displays and printers addressed via predefined poll\select addresses.
3270 Data Stream can be divided into four categories:
- Outbound Data Stream: data stream sent from a host to a control unit.
- Inbound Data Stream: data stream sent to a host by a control unit.
- Standard Data Stream: the basic data stream, as announced with the first 3270 control units.
- Extended Data Stream: enhancements to the standard data stream required to support the seven-color, the extended highlighting and the programmed symbol features announced in 1979 and only supported by control units that contain an optional feature referred to as the `structured field and attribute processing function.
The standard Data Stream is sometimes referred to as Base Data stream, while
Extended Data Stream is sometimes referred to as ructured-field Data Stream.)
-------------- ----------------- coaxial --
| | outbound data | | cable | \-
| | -- stream ----> | |==========+----|
| | | | display
| +------------------| |
| | Link | | coaxial --
| | | | cable -| +-
| | inbound data | |===========+------|
| | <-- stream ---- | | printer
+--------------| +-----------------|
(ASCII character codes are not supported by the Extended Data Stream.)
3 - Fields
3270 datastream is based on the concept of fields. A formatted screen is organized
into fields by the application program. The 3270 datastream defines 3 types
of attributes for these fields as follows:
Field Attributes | Extended Field Attributes | Character Attributes |
Protected or | Field validation | Extended highlighting |
unprotected | ||
Extended highlighting | Colour | |
Alphanumeric or | ||
numeric | Colour | Character set |
Autoskip | Character set | |
Nondisplay or | Field outlining | |
display/intensified | ||
display | ||
Detectable or | ||
nondetectable |
A field consists of the field attribute character and all the data following
it up to (but not including) the next field attribute. A field can wrap from
the end of one row to the beginning of the next row within the presentation
space. A field can also wrap from the last location in the presentation space
to the first location. There is no limit to the number of fields that can be
defined, other than that imposed by the screen size.
Screen
---------------------------------------
| - |
| |A|Text ...|A| |
- . -
| . . |
| . . |
+----.------.---------------------------|
. ...............................
. .
Field Attribute .
---------------
takes one character position .
displayed as a space .
. .
. .
Extended field attribute | Extended character atribute |
always associated with a | extra information associated |
field attribute but does | with a character on the screen |
not take up extra space | but does not take up space in |
in screen memory | screen memory |
4 - Buffer Addressing
3270 Data stream currently caters for six different display buffer sizes:
480 characters (12 rows of 40 characters)
960 characters (12 rows of 80 characters)
1920 characters (24 rows of 80 characters)
2560 characters (32 rows of 80 characters)
3440 characters (43 rows of 80 characters)
3564 characters (27 rows of 132 characters)
Two buffer addressing schemes are available, both of which use two
characters to specify a given buffer location.
12-bit buffer addressing - used with:
outbound & inbound Standard data stream
inbound Extended data stream
outbound Extended data stream
Absolute position = (row number - 1)*presentation space
width + (column number-1)
first address character = Absolute position DIV 64
second address character = Absolute position REM 64
14-bit buffer addressing - only used with:
outbound data stream to control units which
support extended data stream
Absolute position = (row number - 1)*presentation space
width + (column number-1)
prefix with leading zero bits to give 16-bits
5 - Extended data stream
PARTITIONS
If the display supports partitioning, the application program can define a
logical area called a partition that may differ in both size and shape from
the physical display screen. The partition is defined by use of the create partition
structured field. Once a partition has been created, data is transmitted to
and from the partition as if it were a physical screen with the geometrical
characteristics specified in the create partition structured field. The mapping
of the presentation space to the physical screen is transparent to the application
program. The initial state of a display supporting partitions is the implicit
partition state, interaction with implicit partition 0 on a display that does
not support partitioning.
Programmed Symbols
A programmed symbol (PS) is a special character or graphic component that
is loaded by the application program into a symbol set in the device. Each symbol
set contains 190 symbol locations; each location contains a pattern of binary
bits equivalent to the dot pattern contained in each character position on the
display screen
Triple-plane symbol sets
In certain applications it may be necessary to display more than one colour within a single character position. The programmed symbols feature allows the user to define symbols that contain more than one colour, these symbols are stored in a triple-plane symbol set.
6 - 3270 Outbound Data Stream (host to terminal)
Outbound data stream | Inbound data stream
(from host to terminal) | (from terminal to host)
------------------------+---------------------------
| |
S E S CU CU
T S command T add add text...
X C X see inbound
| data stream
------+-----------
| --+----------------------------------------
F3 structured | F1 Write | |
field | F5 Erase/Write | |
| | 7E Erase/Write alternate | |
v | F2 Read Buffer | WCC | text
see outbound | F6 Read Modified | | stream...
structured | 6E Read modified all | |
field | 6F Erase all unprotected | |
+---------------------------+--------+------
------------------------------| |
| |
----------------+---------------- |
| bit0 - reset function | |
| bit1 - 0=partition characters | |
| remain unchanged | |
| - 1=partition characters | |
| to defaults | |
| bit2 - reserved | |
| bit3 - reserved | |
| bit4 - start printer bit | |
| bit5 - sound alarm bit | |
| bit6 - keyboard restore bit | |
| bit7 - reset modified data tag | |
| (MDT) | |
+---------------------------------| |
v
7 - Outbound text stream
Orders embedded into text string:
Order | EBCDIC | ASCII | |
Start Field (SF) | X'1D' | X'1D' | field attribute data.. |
Start Field Extended (SFE) | X'29' | N/A | number of attribute attribute |
type-value type type | |||
pairs | |||
Set Buffer Address (SBA) | X'11' | X'11' | buffer address (2 bytes) |
Set attribute (SA) | X'28' | N/A | attribute attribute |
type value | |||
Modify Field (MF) | X'2C' | N/A | number of attribute attribute |
type-value type type | |||
pairs | |||
Insert Cursor (IC) | X'13' | X'13' | |
Program Tab (PT) | X'05' | X'09' | |
Repeat to address (RA) | X'3C' | X'14' | stop address(2-bytes),character |
Erase unprotected to address (EUA) | X'12' | X'12' | stop address(2-bytes) |
Graphic escape (GE) | X'08' | N/A | character code |
8 - field attribute character
The attribute character takes the space of one character in the display
buffer and is displayed as a blank, it is sent in the outbound datastream
as follows:
-----------------------------------------------
| Start Field | field attribute | data ...
| SF=hex '1D' | character |
---+-------------+-----------------+----------
|
v
-------------------------------
| 0 1 | 2 | 3 | 4 5 | 6 | 7 |
-------------------------------
| | | | | |
| | | | | +------------ Modified Data Tag (MDT)
| | | | | this bit is used to designate
| | | | +-- Reserved fields that have been modified
| | | | by the display operator
| | | +- presentation mode (data entered or contents
| | | 00=Display selector- overwritten)
| | | pen non-detectable 0=not modified
| | | 01=Display selector- 1=modified (an application
| | | pen detectable program can set this bit on
| | | 10=High-intensity when inserting the attribute
| | | display selector- character to ensure that the
| | | pen detectable field is treated as a modified
| | | 11=Non-display, field during read operations,
| | | selector-pen irrespective of operator
| | | non-detectable action)
| | | (non-printable)
| | |
| | +----- Alphanumeric/numeric
| | 0=alphanumeric
| | 1=numeric
| |
| +--------- Protected/unprotected
| 0=unprotected
| 1=protected
|
+--------------- Reserved
contents depend on settings of bits 2 to 7
(qv internal six-bit code structure)
the 3279 uses the field attributes for the additional purpose of
controlling colour, this depends on the setting of the base colour switch
as follows,
Field attribute | attribute bit | base colour | switch |
2 3 4 5 | oo | oooo | |
unprotected, normal intensity | 0 x 0 x | green | green |
unprotected, intensified | 0 x 1 0 | white | red |
protected, normal intensity | 1 x 0 x | green | blue |
protected, intensified | 1 x 1 0 | white | white |
9 - Extended Field Attributes:
Start field | number of | Attribute Type | Attribute Value | |
Extended | type-value | |||
SFE=hex'29' | pairs |
To set Character Attributes:
Set attribute | Attribute Type | Attribute Value | |
SA=hex'28' |
EXTENDED ATTRIBUTE TYPES
Type | Value | may define | |
Extended | Character | ||
Field | attribute | ||
Attribute | |||
00 attribute types | 00 reset all attribute types | N/A | YES |
C0 field attribute | bit pattern as for AID | YES | N/A |
C1 Field validation | bit 0-4=0 | YES | N/A |
bit 5=mandatory fill | |||
bit 6=mandatory entry | |||
bit 7=trigger | |||
C2 Field outlining | bit 0=underline | YES | N/A |
bit 1=right vertical line | |||
bit 2=overline | |||
bit 3=left vertical line | |||
41 Highlighting | 00=default | YES | YES |
F0=normal- as defined by field | attribute | ||
F1=blink | |||
F2=reverse vidio | |||
F4=underscore | |||
42 colour | 00=default colour | YES | YES |
F7=neutral | |||
others=as indicated by query reply | |||
on 3279 models 2B and 3B attached | |||
to a 3274 these are as follows | |||
F1=blue F2=red | |||
F3=pin F4=green | |||
F5=turquoise F6=yellow | |||
F7=white | |||
default for an unformatted display | |||
is always green | |||
43 character set | 00=default character set | YES | YES |
40-EF local ID for loadabe character | |||
sets | |||
F0-F7 local ID for non-loadable | |||
character sets | |||
F8-FE local ID for two byte coded | |||
character sets |
10 - Outbound Structured Fields
general format:
<-- structured field 1 -----> <--- structured field 2 --
Write Structured | Length 1 | ID | information | length 2 | ID | information |
Field Command'F3' | 2 bytes | 1byt | n bytes |
<-------- length 1 ---------> <--------- length 2 ------
Outbound structured fields:
ID | name | parameters |
00 | Reset Partition | byte3=PID |
01 | Read Partition | byte3=PID |
byte4=TYPE 2=Query | ||
3=Query list | ||
6E=Read modified all | ||
F2=Read buffer | ||
F6=Read modified | ||
byte5=REQTYP | ||
byte6-n=QCODES | ||
03 | Erase/Reset | byte3=flags |
06 | Load Programmed Symbols | up to 11 parameters |
09 | Set reply mode | byte3=PID,byte4=mode,byte5-n=attr list |
0B | Set window origin | byte3=PID,byte4-5=RW,byte6-7=CW |
0C | Create Partition | up to 27 parameters |
00 | Destroy Partition | byte3=PID |
0E | Activate Partition | byte3=PID |
40 | Outbound 3270DS | directs 3270 data stream to a named partition |
41 | SCS data | byte3=PID,byte4-n=data |
4A | Select Format group | byte3=PID,byte4-n=format group |
4B | Present Absolute Format | byte3=PID,byte4=FPC,byte5=WCC,byte6-n=name |
4C | Present relative format | byte4-5=FOV,byte6=FPC,byte7=WCC,byte8-n=name |
0F01 | Set MSR control | byte4=PID,byte5=1,byte6=state mask, |
byte7=state value,byte8=IND mask | ||
byte9=ind value | ||
0F0A | Modify Partition | up to 29 parameters |
0F71 | Outbound text header | up to 14 paaameters |
0FC1 | Outbound type 1 text | byte4=PID,byte5-6 must be 0,byte 7-n=text |
Outbound/Inbound Structured Fields
0F02 | Destination/origin | byte4=flags,byte5=0,byte6-7=ID |
0F1F | OEM data | byte4=0,byte5=group,byte6=0,byte7-n=data |
1034 | Save/Restore format | byte4=flags,byte5-n=FPCB |
11 - Inbound Data Stream (terminal to host)
Outbound data stream | Inbound data stream
(from host to terminal) | (from terminal to host)
------------------------+---------------------------
| |
| |
S E S CU CU
T S command T add add data stream..
X C X |
| -------------+------------
v | AID | Cursor | text ..
see | code| address |
section x | | 2 bytes |
+-----+-----------+--------
or
---------------------------------------------
| AID | Structured | | Structured |
| code| Field | ... | Field | ...
| '88'| | | |
+-----+------------+------+------------+------
The following orders may be embedded in the text string:
Order EBCDIC ASCII
Start Field (SF) X'1D' X'1D' field attribute data..
Start Field Extended (SFE) X'29' note number of attribute attribute
type-value type type
pairs
Set Buffer Address (SBA) X'11' X'11' buffer address (2 bytes)
Set attribute (SA) X'28' note attribute attribute
type value
Graphic escape (GE) X'08' note character code
12 - Attention Identification (AID) bytes
AID | EBCDIC | ASCII | |
graphic | (hex) | (hex) | |
No AID generated | 60 | 2D | |
No AID generated (printer only) | Y | E8 | 59 |
Structured Field | h | 88 | |
Read partition | / | 61 | |
Trigger action | " | 7F | |
Test REQ and SYS REQ | 0 | F0 | 30 |
PF1 key | 1 | F1 | 31 |
PF2 key | 2 | F2 | 32 |
PF3 key | 3 | F3 | 33 |
PF4 key | 4 | F4 | 34 |
PF5 key | 5 | F5 | 35 |
PF6 key | 6 | F6 | 36 |
PF7 key | 7 | F7 | 37 |
PF8 key | 8 | F8 | 38 |
PF9 key | 9 | F9 | 39 |
PF10 key | : | 7A | 3A |
PF11 key | # | 7B | 23 |
PF12 key | @ | 7C | 40 |
PF13 key | A | C1 | 41 |
P114 key | B | C2 | 42 |
PF15 key | C | C3 | 43 |
PF16 key | D | C4 | 44 |
PF17 key | E | C5 | 45 |
PF18 key | F | C6 | 46 |
PF19 key | G | C7 | 47 |
PF20 key | H | C8 | 48 |
PF21 key | I | C9 | 49 |
PF22 key | c | 4A | 5B |
PF23 key | . | 4B | 2E |
PF24 key | < | 4C | 3C |
PA1 key | % | 6C | 25 |
PA2 key (CNCL) | > | 6E | 3E |
PA3 key | , | 6B | 2C |
CLEAR key | - | 6D | 5F |
CLEAR PARTITION key | 6A | ||
ENTER key | , | 7D | 27 |
selector-pen attention | = | 7E | 3D |
magnetic readers: Operator ID reader | W | 6E | 57 |
Mag Reader Number | X | E7 | 58 |
13 - Inbound Structured Fields
general format:
<-- structured field 1 -----> <--- structured field 2 --
AID '88' | Length 1 | ID | information | length 2 | ID | information |
2 bytes | 1byt | n bytes |
<-------- length 1 ---------> <--------- length 2 ------
Inbound structured fields:
ID name | parameters |
80 Inbound 3270DS | byte3=PID,byte4=AID,byte5-6=CURSOR |
byte7-n=DATA | |
81 Query Reply | byte3=QCODE,byte4=PLIST |
QCODES: | |
81 usable area | |
83 text partitions | |
84 alpha partitions | |
85 character sets | |
86 colour | |
87 highlight | |
88 reply modes | |
8A field validation | |
8B MSR control | |
8C field outlining | |
8F OEM aux device | |
90 Format presentation | |
91 DBCS-asia | |
92 save/restore format | |
95 DDM | |
99 AUXDA | |
A0 Device characteristics | |
A1 RPQ names | |
A2 data streams | |
A6 implicit partitions | |
FF null | |
0FB1 inbound text header | byte4=pid,byte5=AID,byte6-8=reserved |
byte9=LVL,byte10-11=CRO,byte12-13=CC | |
byte14-15=RW,byte16-17=CW,byte18-19=HW | |
byte20-21=WW | |
0FC1 inbound type1 text | byte4=PID,byte5-6=RES,byte7-n=data |
14 - EBCDIC character codes
15 - ASCII character codes
16 - Sample traces
The following traces were taken Using a Telenex Autoscope tee'd in to an
IBM PC connected to a Telenet 3006 making a call to a Tandem computer
acting as a host (Mediat).
emulated on IBM PC PSS Mediat
................... .......... ....................
. . . . . .
. terminal 3274 . ------ . . . .
. - ---- . | |X.25. . . .
. -/ +-| +-.-| 3006 +----..........--. Tandem .
. +---| +----| . +------| | . . . Host .
. . | . . . .
................... | .......... ....................
|
---+-----
| |
| our |
| tester |
+---------|
The trace is read as follows:
sync timestamp hex coding of
character | data on line
| | |
v v v
from 3010 to host - High BCD --> FFs314:58:5844772FF
low BCD --> FFy2 00FFDFF
from host to 3010 - High BCD --> FFFF FFFFFFF
low BCD --> FFFF FFFFFFF
-------------------
Trace 1
This trace shows text from the terminal to the host followed by a
Erase/Write from the host
Events 1,4 & 5 are BSC protocol only (see IBM-BSC.TXT Martin Baker)
Inbound - terminal to host (event 2)
0447C65554CDEE4CDED45554FF4FC0F5
200D20CCC08623046650CCC000076321
This can be decoded as follows:
02 BSC header
40 " "
40 " "
7D AID code (enter key pressed)
C2 cursor address (row 2, col 80)
60 " "
5C *
5C *
5C *
40 sp
C8 H
D6 O
E2 S
E3 T
40 sp
C4 D
D6 O
E6 W
D5 N
40 sp
5C *
5C *
5C *
40 sp
F0 0
F0 0
40 sp
F7 7
C6 F
03 BSC trailer
F2 " "
51 " "
Outbound - host to terminal (event 3)
02FC14416CE4CCD4
2753100D02309240
EDCCD44444444444444444444444444441C65554CCDD4CCECDDDCCECC45551C41551FCCEECDCECDD
399130000000000000000000000000000120CCC0313304923655533540CCC150D0CD045239513965
71413C661F1CDEECEEEECD7143CE6133F1CECCECCC7143CF61F1CF1551FDCDCCEC4DDCDECD7143C4
AD03C50DD0165242282354AD0C68DD220178455935AD0C78DD0180D0CD0953512507995359AD0C9C
61F1441551FCCDDE4CDDDCCE4CEECDDE161464DDCCC4CEDED44CE47574CDC4DDCEE4CDECD073
DD01A0D0CD0126930365553301335473D01C007313503492690130DCD0154079522055359397
This can be decoded as follows:
02 STX BSC HEADER
27 ESC " "
F5 ERASE/WRITE command
C3 WCC = reset partition characters to defaults,keyboard restore,MDT=1
11 Set buffer address
40 " " " to row 1 col 1
40 " " "
1D Start Field
60 attribute character (protected,alphanumeric field,blue)
CE4CCD4EDCCD4444444444444444444444444444
2309240399130000000000000000000000000000
BT IBM TRIAL
11 Set buffer address
C2 " " " Row 3 Col 1
60 " " "
5554CCDD4CCECDDDCCECC4555
CCC0313304923655533540CCC
*** CALL DISCONNECTED ***
11 Set buffer address
C5 " " " row 5 column 1
40 " " "
1D Start Field
50 attribute character (unprotected numeric,green)
5C *
1D Start Field
F0 attribute character (protected numeric,blue)
CCEECDCECDD7
45239513965A
DESTINATION:
1D Start Field
40 attribute character (unprotected,alphanumeric,green)
13 insert cursor
3C repeat to address
C5 " " " final address is row 5 col 33
60 " " "
6D " " " repeated character is "-"
1D start field
F0 attribute character (protected numeric,blue)
11 set buffer address
C6 " " " row 11 col 6
D5
EECEEEECD7
242282354A
SUBSYSTEM:
1D Start Field
40 attribute character (unprotected alphanumeric,green)
3C repeat to address
C6 " " " inish address= row 6 col 25
E8 " " "
6D " " " character "-"
1D Start field
32 BSC sync characters
32 " " "
F0 attribute character (numeric protected,blue)
11 Set buffer address
C7 " " " row 7, col 9
E8 " " "
CCECCC7
455935A
DEVICE:
1D Start Field
40 attribute character (unprotected,alphanumeric,green)
3C Repeat to address
C7 " " " finish address row 7, col 25
F8 " " "
6D " " " character "-"
1D start field
F0 attribute character (protected,numeric,blue)
11 Set buffer address
C8 " " "
F0 " " "
1D Start Field
50 attribute character (unprotected,numeric,green)
5C C
1D Start Field
F0 attribute character (protected,numeric,blue)
DCDCCEC4DDCDECD7
953512507995359A
RELEASE PRINTER:
1D Start Field
40 attribute character (unprotected,alphanumeric,green)
3C Repeat to address
C9 " " " row 7 col 47
4C " " " character "<"
6D " " "
1D Start Field
F0 attribute character (protected,numeric,blue)
11 Set buffer Address
4A " " " Row 9 Col 1
40 " " "
1D Start Field
50 attribute character (upprotected,numeric,green)
5C *
1D Start Field
F0 attribute character (protected,numeric)
CCDDE4CDDDCCE4CEECDDE
126930365553301335473
ABORT CONNECT ATTEMPT
1D Start Field
60 attribute character (protected,alphanumeric,blue)
11 Set buffer Address
4C " " " row 11 col 1
60 " " "
4DDCCC4CEDEDD4CE47574CDC4DDCEE4CDECD
07313503492690130DCD0154079522055359
PLACE CURSOR AT '*' AND PRESS ENTER
03 ETX BSC trailer
79 BCC
37 BCC
17 - conclusions
3270 datastream has evolved to become a complex and powerful protocol for
communicating with terminals, it allows some of the processing to be devolved
to remote terminal clusters, 3270 is independent of the data link protocol and
terminal clusters such as the 3274 can send the datastream over BSC,SNA,X25
or X21 links.