.. |_| unicode:: 0xA0 :trim: .. role:: small-caps :class: small-caps .. include:: <isonum.txt> .. index:: single:Getting started Getting started =============== .. _HelloAworldA: .. index:: single:Hello, world! Hello, world! ------------- This is a sample program that displays "Hello, world!": :: ---- hello.cob ------------------------- * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello, world!". STOP RUN. ---------------------------------------- | | The compiler, :command:`cobc`, is executed as follows: :: $ cobc -x hello.cob $ ./hello Hello, world! | | The executable file name ( :file:`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 \ :code:`-o`\ as follows: :: $ cobc -x -o hello-world hello.cob $ ./hello-world Hello, world! | | The program can be written in a more modern style, with free format code, inline comments, the \ :code:`GOBACK`\ verb and an optional \ :code:`END-DISPLAY`\ terminator: :: ---- hellonew.cob ---------------- *> Sample GnuCOBOL program identification division. program-id. hellonew. procedure division. display "Hello, new world!" end-display goback. ---------------------------------- To compile free-format code, you must use the compiler option \ :code:`-free`\ . :: $ cobc -x -free hellonew.cob $ ./hellonew Hello, new world! .. _Compile: