From COBOL to OOP

3.1: Replacement for the Data Division: Symbols and Data Types

3.1 Replacement for the Data Division: Symbols and Data Types

In our first tutorial section, we discuss symbols, standard types, declarations, and expressions. Various exercises will help us obtain an initial entry into the programming environment used to apply the newly acquired knowledge.

3.1.1 Symbols

Symbols in a program can be names, keywords, numbers, characters and strings, special characters, and comments. Names that name the things of a program have a few fundamental differences from those in COBOL, which are independent of the language.

Delphi particularity

In Delphi, a name has to begin with a letter, which can be followed by an arbitrary number of letters, numbers, or underscores (_____). The widely used dash in COBOL is not allowed. Also, uppercase and lowercase, as in COBOL, do not play any role; that is, Delphi is a "case-insensitive" environment.

Java particularity: Unicode

In Java, a name can be composed of Unicode characters, which means that (in contrast to COBOL), a name can contain, for example, German umlauts. A name must begin with a letter, dollar sign ($), or underscore (_____). In contrast to COBOL, names are "case sensitive" for example the name Account is not identical to the name account. The widely used dash in COBOL is not allowed, because a dash always represents the minus operation.

Table 3.1 shows a few names and indicates the programming languages in which they are valid.

Table 3.1: Examples of valid and invalid names

COBOL

Delphi

Java

MR27XY

Yes

Yes

Yes

4X

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Programming Languages
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.