TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB IMS-DC Tools Articles Forum Quiz Interview Q&A

IMS Dynamic Attribute Modification

There are times when you will want to change the way field is displayed on the device that is different from the way it is defined in the DOF. For example, you might want to highlight a field that is in error, or to perhaps position the cursor at the first in error. or both.

Whatever the reason, you have the ability to dynamically change the field attribute bytes before sending the message to the device, providing your MOD specified ATTR=YES. Because the attribute bytes are binary, a table of bit settings for the two attribute bytes is shown in below table. The bits are numbered 0 through, in a left to right manner, when defining each attribute's bytes, 0 and 1.


BITS 0-1 If 11, the cursor is placed in the first position of the field ; otherwise code 00, which placed the cursor at the first input field on the screen.
BITS 2-7 Must be 0.


BIT 0 Must be 1.
BIT 1 If 1 – replace the DOF attribute with the attribute value from the output message area. If 0 - the DOF attributes is to be logically OR’D with the value from the output message area.
BIT 2 If 1 – the field is protected.
If 0 – the field is unprotected.
BIT 3 If 1 – the field is considered numeric.
If 0 – the field is considered alphanumeric.
BIT 4 If 1 – the field is displayed in high intensity.
If 0 – the field is displayed in normal intensity.
BIR 5 If 1 – the field is not displayed (hidden).
If 0 – the field is displayed
BIT 6 If 1 – the field is light pen detectable.
If 0 – the field is not light pen detectable.
BIT 7 If 1 – the MDT will be turned on in the DOF.
If 0 – the MDT will not be turned on unless the field is modified on the screen.

Table of Attributes Bytes Settings

These are by no means all the possible attributes, but the most commonly used, Extended attributes, requiring an additional two bytes and controlling such attributes as color, blinking, underlining, and reverse video, will not be covered in this course.

You can use any combination in a single attribute, as long as they are not mutually exclusive. That is to say, you cannot have a field that is both PROTECTED and NONPRROTECTED at the same time, but you can have a field that is PROTECTED and HIGH INTENSITY at the same time. To specify an attribute for a field that is protected, and you need to make the field both protected and high intensity, you can add the high intensity to the field by combining the fields through the use of the logical OR. Let's look at an example.

BYTE   0   BYTE 1

00000000  10100000  (protected)       DOF attribute
00000000  10001000  (High Intensity)  output message attribute
00000000  10101000  (Protected and high Intensity) screen attribute.

This would translate out to a hex value of A8, and a decimal value of +168.

This resultant attribute will be used by MFS to display the field on the screen.

Now that you know the bit settings to accomplish the various display attributes, let's see how this is performed in a program. In the first example, we will see how to initialize an attribute that will cause a field to be hidden. (non display) and pre modified.

DCL C_HID_MOD BIT(16) INIT('0000000010000101'B);

01 C-HID-MOD  PIC S9(4) VALUE + 133 COMP.

Since you cannot twiddle bits in COBOL, you need to perform Base Number arithmetic. The binary value, as we see in the PL/I example, is 0000000010000101. This binary number converts to 0085 in HEX, or + 133 in decimal. We can now code the appropriate COBOL statement.

You probably will not have to do all this conversion for COBOL, as most installations have a predefined table for the COBOL attribute values.

Let's see a more complex example for COBOL. We want to define an attribute for a hidden field and have the cursor placed at that field. In this example, it will also be pre-modified.

DCL C_HID_CUR_MOD BIT(16) INIT('1100000010000101'B);

01 C-HID-CUR-MOD  PIC S9(5) VALUE  -16251 COMP.

Again, we must do Base Number conversion. This time, however, we see the high order bit is on, which means a negative number. In order to evaluate this, we must first get the twos complement.

1100000010000101    original value
0011111101111011    twos complement
             + 1    add one
0011111101111011    binary result

The hex value is 3F7B, or a decimal value of 16,251; do not forget that it is negative, therefore it would be coded as -16251. Notice that the size must increase from S9(4) to S9(5) to hold the value. This is fine, since only the last two bytes contain the value, and movement of this field to a two-byte attribute field will truncate the two high-order bytes, which are not needed.

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!

Are you looking for Job Change? Job Portal