Styles and Special Properties

ACUCOBOL-GT uses a special type of COBOL identifier that is context-sensitive. These are the style and special property names of controls. Each type of control has a set of styles and special properties that apply to it. If these names were reserved words in COBOL, there would be many new reserved words, making it likely that existing programs would have to be changed to be compiled with ACUCOBOL-GT. Because more styles and special properties are expected in future versions, this proliferation of reserved words would create an ever-increasing problem.

To address this issue, ACUCOBOL-GT does not reserve the style and special property names in the usual manner. Instead, the Compiler reserves them only when in the context of acting on a control of the proper type. For example, when you are defining an entry-field control in the Screen Section, the style and special property names associated with entry fields are reserved. At other times, they are not. This allows you to declare variables and paragraphs with the same names as long as you do not try to refer to those items in a context where the reserved meaning would apply.

Style and special property names are reserved in the following four cases:

  1. When defining a Screen Section entry for a control
  2. In the scope of a DISPLAY statement that creates a control
  3. In the scope of a MODIFY statement that changes a control
  4. In the scope of an INQUIRE statement that references a control

At all other times, the style and special property names are not reserved.

Since the Compiler reserves only names that are appropriate for a particular type of control, it can recognize those names only when it knows what type of control is being acted on. If the control class is generic (variable), the Compiler cannot determine which set of names to reserve, so it does not reserve any of them. This leads to cases where the Compiler cannot resolve seemingly correct code.

For example, MAX-TEXT is a special property name associated with entry fields. The following code appears to be correct, but will not compile:

77  FIELD-1  USAGE HANDLE.
MODIFY FIELD-1, MAX-TEXT = 15.

In the above example, the Compiler does not recognize MAX-TEXT as a meaningful word because it does not know that FIELD-1 is an entry field. For this code to compile, you would have to change it to read:

77  FIELD-1  USAGE HANDLE OF ENTRY-FIELD.
MODIFY FIELD-1, MAX-TEXT = 15.

By declaring FIELD-1 as a handle to an entry field, you alert the Compiler to use the style and special property names associated with entry fields whenever it is referenced.

Note: Sometimes you might need to use generic handles in your code when you don't know at compile time what kind of control will be needed during program execution. In these cases, you can always use the alternative form of specifying styles and special properties. In this form, you include the word "STYLE" or "PROPERTY" followed by the numeric value associated with the style or special property (the value can be a literal or stored in a variable). Level 78 declarations for the style and special property names can be found in the file controls.def.

For example, the level 78 name that corresponds to MAX-TEXT is EFP-MAX-TEXT ("EFP" is short for Entry Field Property). The following code is another way of coding the preceding example:

77  FIELD-1  USAGE HANDLE.
MODIFY FIELD-1, PROPERTY EFP-MAX-TEXT = 15.

In most cases, you will probably use the style and special property names known by the compiler. However, the advantage of using the values provided in controls.def is that you can assign them to variables that need to be set dynamically (at run time).