COBOL



Welcome to COBOL at Wikiversity. This area will present information concerning one of the programming languages which, to this day, continues to provide business data processing to the world.

Please forgive the current limited information as the page is built.

"COBOL is widely used in the financial services industry typically for mainframe based applications. It has been used extensively since the 1960s. COBOL was designed for use in business applications and consequently it was implemented with fixed-point arithmetic support. This is one of the advantages of COBOL as it allows complete and accurate computation of financial values without the possibility of rounding errors."

Students with little or no programming experience will benefit by completing the Wikiversity Programming Fundamentals course before beginning this course.

Hello World!
It has become customary to start learning a programming language by writing, building, and executing a program that displays "Hello, World!"

Here is a COBOL source code for a Hello World! program, provided by the Wikiversity Hello, world! course:

Column Significance
When COBOL was originally developed, computer programs were written on 80-column punch cards. The language still contains artifacts of that column orientation. In the punch card era, programs were often written by hand on 80-column coding sheets that corresponded to the 80-columns of each punch card.

Column positions are significant in original implementations of COBOL, and are grouped into the following five fields: Several more modern implementations relax these column requirements.

In COBOL 2002, Areas A and B were merged to form the program-text area, which now ends at an implementor-defined column.

The following characters are allowed in the indicator area:
 * (space) – Indicates a regular source code line
 * – Comment line
 * – Comment line that will be printed on a new page of a source listing
 * – Continuation line, where words or literals from the previous line are continued
 * – Line enabled in debugging mode, which is otherwise ignored as a comment

Running the Program
The Wikiversity course Programming Fundamentals/Introduction/COBOL provides instructions for compiling and executing this program.

Alternatively, students may wish to use an Integrated Development Environment (IDE) that runs on your computer, rather than the simpler but more limited web-based systems. Although this is more difficult than using the web-based system, it is more flexible, more extensive, and better represents production systems.

To do so, follow these linked instructions for /Building and Running a Native IDE/.

Assignment
Modify the example program to display the phrase "Let's learn COBOL!".

Run and test this modified program.

Language References
Because COBOL has continued to evolve since its introduction in 1959 and has been implemented on many different systems, no single document is a definitive language reference. Several useful guides are selected and briefly described here.
 * The TutorialsPoint COBOL Quick Guide introduces the fundamentals of the language. Because it is written as a tutorial, it is accessible, but is not a comprehensive or definitive reference.
 * The COBOL ANSI-85 Programming Reference is useful because it is a American National Standards Institute standard reference for the language published while COBOL was widely used. It has the advantages of being comprehensive description of a recognized standard, however because of its complexity and scope it is difficult to use as a tutorial.
 * The GnuCOBOL Guides are a collection of references for the GnuCOBOL complier. The HTML formatted version is particularly convenient for on-line use. While these are complete and authoritative for the GnuCOBOL compiler, they may not accurately describe other COBOL implementations.
 * If you are doing complex work on a production system it is essential that you obtain and use the language reference that pertains specifically to the system you are using.

Language Fundamentals
Example programs illustrating COBOL language fundamentals were copied from Programming Fundamentals and are linked here:
 * 1) Variables
 * 2) Functions
 * 3) Conditions
 * 4) Loops
 * 5) Arrays
 * 6) Strings

Wikibooks

 * COBOL