Posted by: DOCSERVE | February 15, 2012

COBOL TUTORIAL

COBOL is a high level programming language of the procedural type. That is, it is not a functional, logic-oriented or object-oriented language. It is used primarily in the implementation phase of software development, like most programming languages. Sometimes, though, low-level designs are written in a COBOL-like pseudo code. A COBOL programmer writes a program using keyboard entry of text, because the most common human to computer medium at the time of its invention was the punch card. The name COBOL is an acronym that expands to Common Business Oriented Language. It was designed to be used in business applications. Today, we would say Information Systems. It continues to be most commonly used in Information Systems applications.

If you look at the COBOL coding in later sections (e.g. League Table program in the Sample code section) the specific positions of coding elements are important for the compiler to understand. Essentially, the first 6 spaces are ignored by the compiler and are usually used by the programmer for line numbers. These numbers arenot the same as those in BASIC where the line number is used as part of the logic (e.g. GOTO 280, sending the logic to line 280).

The seventh position is called the continuation area. Only certain characters ever appear here, these being:

*

(asterisk),

/

(solidus or forward slash), or

-

(hyphen).

The asterisk is used to precede a comment, i.e. all that follows is ignored by the compiler. The solidus is used to indicate a page break when printing coding from the compiler, but it too can be used as comment since the rest of the line is ignored by the compiler. The hyphen is used as a continuation marker, i.e. when a quoted literal needs to be extended over to the next line. It is not for continuing a statement onto the next line (this is unnecessary*) and also cannot be used to continue a COBOL word. (*You can write any COBOL statement over as many lines as you like, so long as you stay in the correct coding region and don’t split strings.)

COBOL-Tutorial(doc)


Categories