

Coding Standards for Database Files › Coding Standards for COBOL Programs › Naming Standards in COBOL › COBOL Field Naming Convention
COBOL Field Naming Convention
Wherever possible, the names of fields should be the same as those in the externally described file from which they are obtained. This helps to standardize the naming of fields, and also makes the mapping of fields between files, clearer. If necessary, use a different prefix to indicate that the field is a work field or a device field. For example, JJCUCD could give P1CUCD, Z1CUCD, and WWCUCD.

Format identifier—‘II’ is either the format identifier from a database or a device file, or else a work prefix.

Mnemonic—MMMM is a mnemonic constructed according to the rules given in the chapter about naming conventions. Note that MMMM is not restricted to four characters in COBOL, but can be extended up to the limit of the operating system to give more meaningful names.
For the names of fields which act as accumulators, use an appropriate prefix + the mnemonic of the field being accumulated. This helps to make the mapping of a field from format to format, clear. For example:

Special cases:
- Program control variables. Fields which do not appear in any externally described file should be given meaningful names prefixed by a ‘C-’; for example, C-CHANGE-MODE. Use a hyphen between words.
- Arrays. Indicate that a variable is an array by a suffix ‘-A’; for example XF-A.
- Array indices. The names of array indices should, if possible, relate to the names of the arrays they index; they should contain the same letters without the suffix. For example, XF might be the name of the index for array XF-A, giving XF-A(XF) as an occurrence.
- Standard fields. Fields that serve the same common role in many different programs may use a single three-character mnemonic to indicate that they are standard fields; for instance, xxRTN - the return code. The CA 2E application generator uses this technique.
- Parameter fields. Fields that are parameters passed to other types of programs may, in order to keep the field names the same in both programs, take the field name as it appears in the other program.
For instance:

Copyright © 2014 CA.
All rights reserved.
 
|
|