You are on page 1of 21

HELLO WORLD program in

COBOL - CIS12
Please use speaker notes for
additional information!

Hello World

To load MicroFocus COBOL


after it has been installed on your
computer, go to Programs,
Personal COBOL, Personal
COBOL. COBOL will load.

Hello World

I keyed in the lines of the program and saved it using File, Save As The name I
gave the file is hello.cbl.

This slide talks about the


IDENTIFICATION DIVISION
& ENVIRONMENT DIVISION.

Hello World

This slide talks about the


DATA DIVISION.

In memory, there will be a one


character area called GET-ANS
where the user response will be
stored.

GET-ANS

Hello
World

The code for the


PROCEDURE DIVISION.

Hello World

Select Compile Program to test


the program and if it is correct
turn it into machine language.

Hello World - after


successful compile

Hello World compile error

ERROR: Command/verb DISPLAY


written as DSPLAY.

Hello World compile error

Hello World compile error

This time I put a period


after GET-ANS before the
PIC X. This meant that
the PIC made no sense
and the GET-ANS field
had a problem because it
needed a PIC.

Hello World compile error

Hello World compile error

Hello World - fix


compile error

Error has been


corrected.

Hello World execute

Select Open for execution when


you want to run your program.

Hello World - open


for execution

Click on hello.int to select it for


execution and then click OK.

Hello World executing

Hello.int is now open and shown on the screen.

Compile/Run followed by Run will


execute the program.

Hello World executing

Hello World execute

Hello World - source


program loaded