HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
22 user(s) are online (1 user(s) are browsing Wiki)

Members: 0
Guests: 22

more...
Powered by
SourceForge

Xoops

Creative Commons



Getting Started

Hello World!

This is a sample program that displays "Hello World":

The I of IDENTIFICATION must be at the column 8 ( 7 spaces before ).

---- hello.cob -------------------------
     * Sample COBOL program
      IDENTIFICATION DIVISION.
      PROGRAM-ID. hello.
      PROCEDURE DIVISION.
      DISPLAY "Hello World!".
      STOP RUN.
----------------------------------------

The compiler is cobc, which is executed as follows:

$ cobc -x hello.cob
$ ./hello
Hello World!

The executable file name (i.e., hello in this case) is determined by removing the extension from the source file name.

You can specify the executable file name by specifying the compiler option -o as follows:

$ cobc -o hello-world hello.cob
$ ./hello-world
Hello World!


Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Counter: 73213, today: 31, yesterday: 29
Last-modified: Fri, 19 Sep 2008 08:19:46 GMT (2134d)
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net