COBOL

From Computer History Wiki
(Redirected from Cobol)
Jump to: navigation, search

Common Business Oriented Language

COBOL is primarily found on the mainframe environments, and related to business 'batch' processing.

Example

Here's Hello World in COBOL.

      IDENTIFICATION DIVISION.
      PROGRAM-ID.    HELLOWORLD.
      ENVIRONMENT DIVISION.
      DATA DIVISION.
      PROCEDURE DIVISION.
          DISPLAY 'HELLO WORLD! ' .
          GOBACK.

Another variant, specifically for the RM/1 COBOL compiler:

      IDENTIFICATION DIVISION.
      PROGRAM-ID.     HELLOWORLD.

      ENVIRONMENT DIVISION.
      CONFIGURATION SECTION.
      SOURCE-COMPUTER. RM-COBOL.
      OBJECT-COMPUTER. RM-COBOL.

      DATA DIVISION.
      FILE SECTION.

      PROCEDURE DIVISION.
      
      MAIN-LOGIC SECTION.
      BEGIN.
          DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
          DISPLAY "Hello world!" LINE 15 POSITION 10.
          STOP RUN.
      MAIN-LOGIC-EXIT.
      EXIT.

References