<%@ Page %>
"Hello World" - the COBOL Way
One of the excellent feature of .NET is multiple language support. If you
already have skills in one of the supported languages the learning curve
will be much less. There are more than 20 languages (including C#, VB.NET,
Managed C++ and JScript.NET) that can be used to develop applications
targeted at .NET framework. Fujitsu has developed a dialect of COBOL called
NetCOBOL for .NET. You can download the compiler from their
This simple application is Hello World application developed in COBOL.NET.
COBOL Reference Formats
The COBOL code must be written according to the "reference format". The
Reference Format is rule stating which element is being placed in which
position on the line.
The 3 Types of Reference Formats are:
- Fixed Format
- Variable Format
- Free Format (Specific to Win32 and Sun)
Below given is the configuration of the Source code using either Fixed or
Variable Reference format. (Note: Position here refers to column Number.)
- Position 1-6 - Sequence Number Area
- Position 7 - Indicator Area
- Position 8- 11 - Area A
- Position 12-72 - Area B
- Position 73 - 80 Program Identification Number Area (For Fixed Formats
COBOL consists of several divisions which are as follows:
- IDENTIFICATION DIVISION : Specifies name of program and program
attributes. Must be placed at the beginning of the program
- ENVIRONMENT DIVISION (Optional) : Followed by the IDENTIFICATION
DIVISION. Specifies the environment suited for the computer that runs the
- DATA DIVISION.(Optional) : Consists of 7 sections.
1.BASED STORAGE SECTION
The entries in the DATA DIVISION must be in the above order
- PROCEDURE DIVISION : Contains the procedures to be executed by the
Open VS.NET and select COBOL Projects -> Console Application. Alternatively,
you can also write it in Notepad and save the file as simpleHello.cob. Write the code snippet given below:
000330 IDENTIFICATION DIVISION.
000340 PROGRAM-ID. MAIN.
000350 AUTHOR. Sushila Bowalekar.
000360 DATE-WRITTEN. 25 June 2002.
000380 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000410 WORKING-STORAGE SECTION.
000430 PROCEDURE DIVISION.
000440 DISPLAY "Hello World! "
000450 DISPLAY "From COBOL.NET!!"
000460 END PROGRAM MAIN.
Compiling the code
You can compile the application directly from VS.NET or you can compile it by typing following command :
cobolc -main:MAIN simpleHello.cob
Now run the application go to the specific folder and start the .exe generated.
In the next article we will see how to display message box using COBOL.NET.