Setting Field Attributes in an Advantage COBOL/XE Application
search cancel

Setting Field Attributes in an Advantage COBOL/XE Application

book

Article ID: 55539

calendar_today

Updated On:

Products

COBOL/XE

Issue/Introduction

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

What is an COBOL/XE Field Attribute?

An COBOL/XE field attribute is a one byte field that occupies the first position of each field that is defined on a 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.

 

Environment

Release:
Component: COBOLX

Resolution

How to Change a Field Attribute

Before you can use field attributes in an COBOL/XE program, you must define the fields on an COBOL/XE panel. 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 COBOL/XE program. The working storage must contain a COPY statement with your COBOL/XE panel.

COPY PANEL MYPANEL.

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.

MOVE   'XXXXX' , AUTOSKIP,   RED    to    FIELDA.

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).

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.

MOVE ALL OF FIELDA    TO    FIELDB.

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.

IF FIELDA MODIFIED
   PERFORM PARAGRAPH-1.

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 COBOL/XE PAINT Manual and the COBOL/XE Language Reference Manual.

Contribute Your Ideas

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