Entry
Cobol: Program: Simple: How to write a simple 'Hello world' program in Fujitsu Cobol v3.1?
Oct 4th, 2003 17:02
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 04 October 2003 - 09:08 pm --------------------
Cobol: Program: Simple: How to write a simple 'Hello world' program in
Fujitsu Cobol v3.1?
---
Steps: Overview:
1. -Write your COBOL source code using your favorite text editor
(e.g. Notepad from Microsoft, or TSE from http://www.semware.com)
1. Remember to put the source code in the correct areas
2. -Save your COBOL source file with the extension '.cob'
1. So save your helloworld program e.g. as 'helloworld.cob',
after copying it from here below:
--- cut here ---------------------------------------------------------
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. HELLO-WORLD-PROG.
000030 AUTHOR. TIMOTHY R P BROWN.
000040*The standard Hello world program
000050
000060 ENVIRONMENT DIVISION.
000070
000080 DATA DIVISION.
000090 WORKING-STORAGE SECTION.
000100 01 TEXT-OUT PIC X(12) VALUE 'Hello World!'.
000110
000120 PROCEDURE DIVISION.
000130 MAIN-PARAGRAPH.
000140 DISPLAY TEXT-OUT
000150 STOP RUN.
--- cut here ---------------------------------------------------------
3. -Open the Fujitsu COBOL 'Programming Staff' application
4. -select 'Wincob' from the 'Tools' menu
5. -From the dialog box marked 'Source file' click 'Browse'
6. -select your filename (e.g. 'Helloworld.cob') from the folder where
you saved it
7. -Click on 'options...'
8. -A new dialog box will appear.
9. -Here you should click on 'Add...'
where an dialog will appear (labelled 'Compiler options').
10. -Scroll down the list and select 'MAIN'
and then click 'ADD'.
11. -You should now see a dialog asking whether to
compile as a main program or as a sub program.
12. -Select 'compile as main program' and click 'OK'.
13. -You will be returned to the 'Compiler options' dialog where you
will see 'MAIN' appear in the 'options' list.
14. -Now click on 'cancel' where you will return to the main 'Wincob'
box
15. -Now, click on the 'Compile' button and the program should compile.
16. -A clock display will turn and then a P-STAFF window will appear.
16. -If the compilation went OK, then it will display a message saying:
STATISICS: HIGHEST SEVERITY CODE=I, PROGRAM UNIT 1.
17. -If there are any syntax errors (or other problems) they will be
reported here, along with the line number (note the line number it
uses is not read from your line numbers but from simply counting
the number of lines in the source file).
18. The P-STAFF window must be closed before you can compile again (or
link).
19. The compilation process will produce a new file (in the same
directory) called:
'Helloworld.obj'
which is what you will use to link.
(In Windows Explorer you may have to press F5 to 'refresh' the
window whereupon the new file will appear).
20. From the 'tools' menu of the 'Programming Staff', select 'Winlink'
21. Enable radio button 'Target' to 'EXE'
22. In the box marked 'Link object':
1. Supply your .obj filename:
1. Fill in filename (e.g. 'helloworld.ojb') in
the box 'Link file',
2. or otherwise click on 'browse',
and select 'Helloworld.obj'
2. and then click on 'ADD'.
23. You will see that the box above should automatically add
'...\...\Helloworld.exe'
(make sure that it has not given you 'Helloworld.dll',
otherwise check the box 'EXE' instead of 'DLL')
24. Click on 'Link' and a DOS window will appear with stuff going on.
25. When it is finished just close the DOS window.
26. Now, if you look in the folder where you are source and object
files are you will see 'Helloworld.exe' .
27. Double click on the icon and a dialog box appears called 'Winexec'
(you can run this from the Programming staff tools menu if you
prefer).
28. Just click 'OK' and the program will run.
---
Note:
You only need to set the compiler options once for a
new program, then it will remember when you do it again. It is
important to have a PROGRAM-ID set in the IDENTIFICATION DIVISION as
this is how the compiler recognizes your program.
---
[Internet: source: http://www.google.com search for 'how to write
hello world in Fujitsu Cobol?':
http://members.lycos.co.uk/ZingCOBOL/fuj-comp-how.html]
---
---
Internet: see also:
Cobol: Compile: Command line: How to compile Fijitsu COBOL v3.1 from
the MSDOS command line?
http://www.faqts.com/knowledge_base/view.phtml/aid/25139
Cobol: Execute: Error: 'This application has failed to start because
F3BIPRCT.dll was not found'
http://www.faqts.com/knowledge_base/view.phtml/aid/25116/fid/789
Welcome to the ACM "Hello World" project: Cobol
http://www2.latech.edu/~acm/helloworld/cobol.html
http://www.google.com: search for 'how to write hello world in Fujitsu
Cobol?': http://members.lycos.co.uk/ZingCOBOL/fuj-comp-how.html
----------------------------------------------------------------------