COBOL User-defined Words
Any word that is defined by the developer is called as a user-defined word and is used to store the data. It can be of maximum length is 30 bytes (except for level-numbers).
Rules -
- The user-defined word should be unique within the type to which it belongs (that might be a program, paragraph, etc.).
- User-defined word can be duplicated at the elementary level. The reference should be used with condition-names, data-names, record-names and paragraph-names.
- Each word atleast have one letter.
Examples -
The below list shows the examples for each type of user-defined name -
| User-defined name | Some Examples |
|---|---|
| Alphabet name |
SORT-SEQ is the alphabet-name. |
| Condition name |
STD-MALE, STD-FEMALE are the condition-names. |
| Constant name |
WS-PI is the constant-name. |
| Data item name Variable name |
WS-VAR is the data-item-name. |
| File name |
INPUT-FILE is the file-name. |
| Index name |
MARKS-INDEX is the index-name. |
| Mnemonic name |
SRW is the mnemonic-name. |
| Paragraph name |
PARA-DISPLAY is the paragraph-name. |
| Program name |
MTHPROG1 is the program-name. |
| Record name |
WS-REC is the record-name. |
| Routine name |
ROUTINE1 is the routine-name. |
| Section name |
SEC-ADDITION is the section-name. |
| Key name |
WS-REC-KEY is the key-name. |
| Symbolic character |
BACKSPACE is the symbolic-character. |
| Text name |
WS-MTH is the text-name. |