The 3270 model 2 can display a maximum of 1920 characters. This is because it has 24 rows of 80 characters. The number 80 was chosen because there are 80 characters in a standard punched card. This means the 3270-2 gives allows us to display 24 punched cards at a time. Each character position on the 3270 is addressed by its offset from the top left corner of the terminal. This character position is 0. The second character position on the top row is 1. This continues to the 80th position on the 24th row (right bottom corner) which is position 1919. A characters position is referred to as its "Buffer Address".
The 3270 data stream commands allow us to divide the 1920 characters into multiple fields. A field is composed of a special character that defines the attributes of the field followed by a string of one or more characters. This special "Attribute Character" uses up one of the characters in the 3270 buffer and is always displayed as a blank on the terminal screen.
The Attribute Character defines the characteristics of a field and consists of a standard eight-bit byte.
It has the following format:
|0||The value of this bit is determined by the value of the other seven bits|
|1||The value of this bit is determined by the value of the other seven bits|
|2||1 = Protected or 0 = Unprotected|
|3||1 = Numeric or 0 = Alpha|
|4 & 5||Bits 4 and 5 indicate how the field is to be displayed|
|6||Reserved, Set to Zero|
|7||Modified Data Tag|
Bits 0 and 1 are not used and their values are determined by the values of the other six bits. Later in the tutorial I will provide an explanation on how to determine the value of these two bits.
If bit 2 is set to one, the field is protected which means it is an output field... no data can be entered from the keyboard into a protected field. If this bit is set to zero, then the terminal user can type data into this field.
If bit 3 is set to one, the only numeric data can be entered into this field. If it is set to zero, then both alpha and numeric data can be entered into the field.
If bit 3 is set to one (numeric) and bit 2 is set to one (protected) then this field has the skip attribute. This means that when the cursor advances into this field as a result of typing, the cursor will jump over or skip the field and go to the next field that is not set as skip. The cursor will wrap from the bottom right corner to the top left corner if necessary.
Bits 4 and 5 work together to define how the field is to be displayed on the terminal. There are four options:
00 = Normal display intensity, not light pen detectable
01 = Normal display intensity, light pen detectable
10 = Intensified and light pen detectable
11 = Field data is not displayed
For the purposes of this tutorial I will not concern ourselves with the use of a light pen. Most 3270 terminals never had that optional feature.
Bit 6 is not used (or in IBM terminology it is Reserved) and is therefore set to zero.
Bit 7 is the Modified Data Tag (MDT) bit which we will discuss below
Now we need to tackle the MDT bit. It is pretty simple to understand. The 3270 simply keeps track of all the input fields and sets the MDT bit if a field is modified by the terminal user. This was a very good idea when the 3270 was developed because this means that for an input operation, we can ask the 3270 to only send us the input fields that were modified. In the old days when your remote 3270 was connected over a very sloooooow communication link, you wanted to send as few characters as possible.
When we define a field, we can set the initial value of the field to either modified or unmodified. Normally we would set the value to unmodified. If for some reason we always want the 3270 to return a specific field when we read the modified fields, we can preset the MDT bit.