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.
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:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. PROCEDURE DIVISION. DISPLAY 'Hello, World!'. STOP RUN.
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.
|1-6||Column Numbers||Reserved for line numbers.|
|7||Indicator||It can have Asterisk (*) indicating comments, Hyphen (-) indicating continuation and Slash ( / ) indicating form feed.|
|8-11||Area A||All COBOL divisions, sections, paragraphs and some special entries must begin in Area A.|
|12-72||Area B||All COBOL statements must begin in area B.|
|73-80||Identification Area||It can be used as needed by the programmer.|
Running the ProgramEdit
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.
Modify the example program to display the phrase "Let's learn COBOL!".
Run and test this modified program.
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.
Example programs illustrating COBOL language fundamentals were copied from Programming Fundamentals and are linked here:
- QuiteUnusual (13 March 2009). "Software Engineers Handbook/Language Dictionary/COBOL, In: Wikibooks". San Francisco, California: Wikimedia Foundation, Inc. Retrieved 2014-10-18.
- TutorialsPoint, COBOL, basic syntax https://www.tutorialspoint.com/cobol/cobol_basic_syntax.htm