Sha256: 6c087726aa72f872fb601a6f43f05b5912b100cdc325626862b3b1cb26c12fe5

Contents?: true

Size: 777 Bytes

Versions: 10

Compression:

Stored size: 777 Bytes

Contents

Using fixed format.
{{works with|OpenCOBOL}}
{{works with|Dell Enterprise COBOL}}

	program-id. hello.
	procedure division.
		display "Hello world!".
		stop run.

Using relaxed compilation rules, the hello program can become a single DISPLAY statement.
{{works with|GnuCOBOL}}

display"Hello, world".

prompt$ cobc -x -frelax-syntax -free hello.cob
hello.cob: 1: Warning: PROGRAM-ID header missing - assumed
hello.cob: 1: Warning: PROCEDURE DIVISION header missing - assumed

prompt$ ./hello
Hello, world

''Note how COBOL can handle the DISPLAY reserved word without a space before the quoted string, the quote being a compile time scan delimiter.  The full stop period after the single statement is still mandatory, at least for GnuCOBOL and a clean compile to executable.''

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/hello_world.text/cobol.txt
zettacode-0.1.6 files.zettacode/hello_world.text/cobol.txt
zettacode-0.1.6 files.zettacode2/hello_world.text/cobol.txt
zettacode-0.1.5 files.zettacode/hello_world.text/cobol.txt
zettacode-0.1.5 files.zettacode2/hello_world.text/cobol.txt
zettacode-0.1.4 files.zettacode/hello_world.text/cobol.txt
zettacode-0.1.4 files.zettacode2/hello_world.text/cobol.txt
zettacode-0.1.3 files.zettacode/hello_world.text/cobol.txt
zettacode-0.1.2 files.zettacode/hello_world.text/cobol.txt
zettacode-0.1.1 zettacode.files/hello_world.text/cobol.txt