Previous Topic Next topic Print topic


Identical Field Names

In COBOL, you distinguish fields with identical names by qualification. For example, there are two fields named RATE in the following code, but they can be qualified by their group items. Thus, you would reference RATE OF TERMS-CODE and RATE OF AR-CODE in your program:

01  record-area.
    03  terms-code.
        05  rate                   pic s9v999.
        05  days                   pic 9(3).
        05  descript               pic x(15).
    03  ar-code.
        05  rate                   pic s9v999.
        05  days                   pic 9(3).
        05  descript               pic x(15).

Database systems consider duplicate names an error. Thus, if more than one field in a particular file has the same name, the XFD is not generated for that file.

The solution to this situation is to add a NAME XFD directive that associates an alternate name with one or both of the conflicting fields.

Previous Topic Next topic Print topic