faqts : Computers : Programming : Languages : Cobol

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

20 of 25 people (80%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

Cobol: Compile: Command line: How to compile Fijitsu COBOL v3.1 from the MSDOS command line?

Oct 4th, 2003 17:00
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 05 October 2003 - 00:45 am --------------------

Cobol: Compile: Command line: How to compile Fijitsu COBOL v3.1 from 
the MSDOS command line?

Steps: Overview:

 1. -Create a batch file containing the following text:

--- cut here ---------------------------------------------------------

@REM store your old path

@SET oldpathS = %PATH%

@REM add the Fujitsu COBOL path in front, so to be sure its executable 
is found

@SET PATH=c:\fsc\pcobol32\;%PATH%

@REM make sure your original file can be found, by copying it to a 
known location (e.g. c:\temp)

@COPY %1 c:\temp\%1.cob

@REM compile with cobol32.exe, this will generate a .obj file in the 
same directory

cobol32.exe -WC,MAIN c:\temp\%1.cob

@REM using Microsoft link, with the use of standard libraries (like 
kernel32)

@REM the following is all on one line!

link.exe c:\temp\%1.obj c:\fsc\pcobol32\f3bicimp.lib c:\fsc\pcobol32
\libc.lib c:\fsc\pcobol32
\kernel32.lib /SUBSYSTEM:windows /OUT:"c:\temp\%1.exe"

c:\temp\%1.exe

@PAUSE

@SET PATH=%oldpathS%

@EXIT

--- cut here ---------------------------------------------------------

 2. -Save this file e.g. as 'comCOBOL.bat'

 3. -Create a source file containing your COBOL program
     (e.g. 'helloworld.cob')

 4. -Then run this batch file with the filename only
     (thus no .cob extension)

       comCOBOL.bat helloworld

 5. -You will see an MSDOS screen similar to the following:

        1 file(s) copied.

c:\wordproc\tse32_v40025\knud>cobol32.exe -WC,MAIN 
c:\temp\helloworld.cob
STATISTICS: HIGHEST SEVERITY CODE=I, PROGRAM UNIT=1

c:\wordproc\tse32_v40025\knud>link.exe c:\temp\helloworld.obj 
c:\fsc\pcobol32\f3
bicimp.lib c:\fsc\pcobol32\libc.lib c:\fsc\pcobol32
\kernel32.lib /SUBSYSTEM:wind
ows /OUT:c:\temp\helloworld.exe
Microsoft (R) 32-Bit Incremental Linker Version 3.00.5270
Copyright (C) Microsoft Corp 1992-1995. All rights reserved.


c:\wordproc\tse32_v40025\knud>c:\temp\helloworld.exe
Press any key to continue . . .

---

 5. -Click button 'OK', after the compilation runs OK, and you see the
     'environment variable setup' dialog box.

 6. -That will show the output of your COBOL .exe program
     (e.g. 'Hello world!')

---
---

Note:

Here I use the c:\temp directory to store the temporary results.
Change this to the location on your computer, or create a
directory 'c:\temp', if it does not exist already.

---
---

Note:

This has been tested, running Fijitsu Power COBOL v3.1,
on Windows XP Professional, and worked OK.
[kn, ni, su, 05-10-2003  1:32:45]

---
---

Internet: see also:

[Internet: source: http://www.google.com search for 'cobol32.exe': 
http://groups.google.com/groups?q=cobol32.exe&hl=en&lr=&ie=UTF-
8&selm=to_28.2955%2458.2431421%40newssrv26.news.prodigy.com&rnum=3]

Cobol: Download: Free: Where to download a free evaluation/trial 
version or get a CD of Cobol?
http://www.faqts.com/knowledge_base/view.phtml/aid/25101/fid/789]

Language: Computer: Cobol: Install: How to install and run Fujitsu 
Power Cobol v3.1?
http://www.faqts.com/knowledge_base/view.phtml/aid/25108/fid/789]

Cobol: Program: Simple: How to write a simple 'Hello world' program in 
Fujitsu Cobol v3.1?
http://www.faqts.com/knowledge_base/view.phtml/aid/25118/fid/789

Cobol: Compile: Command line: Error: 'unresolved external symbol 
_main' [link.exe]
http://www.faqts.com/knowledge_base/view.phtml/aid/25144/fid/789

----------------------------------------------------------------------