Setting Field Attributes in an Advantage CA-COBOL/XE Application

Document ID : KB000055539
Last Modified Date : 14/02/2018
Show Technical Document Details

This article will discuss and demonstrate how to set and modify field attributes in an Advantage CA-COBOL/XE program.

What is an Advantage CA-COBOL/XE Field Attribute?

An Advantage CA-COBOL/XE field attribute is a one byte field that occupies the first position of each field that is defined on a CA-COBOL/XE panel. The position appears as a space on the display screen. A field attribute can control how a field is displayed and what can be entered into a field and can also determine if the field had been updated. There are two types of field attributes: Basic and Extended. Basic field attributes are PROTECTION, INTENSITY, DETECTABILITY, INPUT-MDTS and OUTPUT-MDTS. Extended fields attributes are HIGHLIGHT and COLOR.

How to Change a Field Attribute

Before you can use field attributes in an Advantage CA-COBOL/XE program, you must define the fields on an Advantage CA-COBOL/XE panel. Please refer to Technical Document TEC287212. Once you have set up the fields on the panel and turned on the desired field attributes, you are ready to manipulate the field attributes in your Advantage CA-COBOL/XE program. The working storage must contain a COPY statement with your Advantage CA-COBOL/XE panel.


Now you are ready to use the MOVE statement to set your field attributes. One or more field attributes can be specified on a single MOVE statement.


In the above sample MOVE statement, we are moving a value of 'XXXXX' to FIELDA. At the same time we are setting the field to the color RED and not allowing the end user to tab to that field (AUTOSKIP).

Advantage CA-COBOL/XE also has a special register called DEFAULT-FIELD-ATTRIBUTES (or DFA). DFA will reset all attributes (other than MDT) to their default values.

MOVE   DFA    to   FIELDA.

DFA will set FIELDA's field attributes to the default values (i.e., NO-COLOR, AUTOSKIP, and NO-TRIGGER).

COBOL/XE also allows you to set the field attributes of one field to another field.


In the above example, all of FIELDB's field attributes will be set to the same attributes as FIELDA.

You can also test to see if a field has been entered or modified. Just check to see if the field attribute called MODIFIED was set.


In the above IF MODIFIED example, if FIELDA was modified then PARAGRAPH-1 will be performed.

Note: If more than one reference to the same type of attribute appears in a MOVE statement, the latter reference takes precedence.

For example:      MOVE RED, BLUE   TO   FIELDA.

FIELDA will display in BLUE.

Read More About It

To learn more about field attributes, refer to the CA-COBOL/XE PAINT Manual and the CA-COBOL/XE Language Reference Manual.

Contribute Your Ideas

If you have a technique that you would like to share with the Advantage CA-COBOL/XE community as a published article, please contact Advantage CA-COBOL/XE Customer Support.