How can i make my cobol program to be executable file or .Bat

3.7k views Asked by At

Is it possible to make my cobol program to executable file or having .bat? just like in java they have .jar file.

1

There are 1 answers

0
Valdis Grinbergs On BEST ANSWER

Either COBOL.EXE or COMPILE.BAT in MS-COBOL 2.20 can create an intermediate file. If your source code is HELLO.COB, use either:

COMPILE.BAT HELLO 

or

COBOL.EXE HELLO.COB,HELLO.INT,HELLO.LST

Both commands will produce the intermediate file HELLO.INT. The intermediate file can be run with

RUNCOB HELLO

That command could be put into a .BAT file to create an "executable" file that might fit your need.

MS-COBOL 2.20 also comes with LINK.EXE that should be able to turn HELLO.INT into HELLO.EXE. I could not get it to work on Windows XP. MS-COBOL 2.20 was written for DOS, not Windows, so I am not surprised.

All that being said, please do not use MS-COBOL 2.20. It is very old and there is little documentation available. For Cobol on the PC, Microfocus and Fujitsu have good compilers, but you need to pay for them at some point. I use and recommend OpenCobol, which is open source. It is available for free for Windows and Linux and has good documentation. Please see opencobol.org. The direct link to the documentation is http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf. A fast way to get OpenCobol on WindowsXP is using OpenCOBOL-1.1-06FEB2009-mingw.zip (see link and instructions near the bottom of http://www.opencobol.org/modules/bwiki/index.php?Assorted%20Documents).