Language Structure
This chapter presents detailed information on the structure of the language. This includes the structure of program units, the valid character set, words and types of statements.
The smallest element in the language is the character. A character is a digit, a letter of the alphabet, punctuation or a special mark. A word is one possible result obtained when one or more characters are joined in a sequence of contiguous characters. Just as English words are determined by rules of spelling, so COBOL words are formed by following a specific set of rules.
Using syntactic and grammatical rules, words and punctuation characters are combined into statements, sentences, paragraphs and sections. When using the English language, a failure to follow the rules of grammar and sentence structure may cause misunderstanding: the same is true when writing a COBOL source program. It must be emphasized that a thorough knowledge of the rules of the language structure is a prerequisite to writing a workable program Character Set
The RM/COBOL character set is shown in Table. Inside nonnumeric literals and in comment-entries and comment lines, other characters may be used but have no grammatical meaning.
Characters are combined to form either a separator or a character-string.
Lowercase letters are allowed anywhere and are treated as uppercase letters except in nonnumeric literals and when used as the currency symbol in PICTURE character-strings. Within hexadecimal, non numeric literals, the lowercase letters a,b,c,d,e,and f are equivalent to the uppercase letters A,B,C,D,E,and F.
|