Previous Topic Next topic Print topic


Avoiding data name conflicts

Some data names are shortened when used in an external context.

You can use the "#" character at the start of a COBOL data name in order to give an item a name that might otherwise be a reserved word (for example #Move). When the name is externalised, the "#" symbol is stripped from the name. Thus, if there are two COBOL names in the same context, which differ only by one having the initial '#' symbol, an error will result if the names are both to be externalised.

Examples of contexts in which names are externalised are fields that are instance or static data in a class, or the level 78 constants associated with an enum. For instance, the following enum definition will produce an error:

Enum-id MyEnum.
  78 Red value 1.
  78 #Red value 2.
End enum.
Previous Topic Next topic Print topic