Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help urgent

Status
Not open for further replies.
Dec 9, 2002
13
IN
Hai friends,

I have installed Cobol5 for DOS in my system. As I am new to Cobol and doing a self study, kindly tell me how to compile and run a simple cobol program in this version and to see the output.
As I am desperate plz help.

Thanx in advance.
 
Not familiar with that dialect. Can you tell me where you got it so that I can take a look?
 
Hi,

In your system, look at the executable files.
For example:

COBOL.EXE
REALCOB.EXE

or

COBOL.BAT

things like that.

The general format to compile is:

COBOL MYPROG;

The general format to link is:

LINK MYPROG;

But it depends on the system you are working with.

Regards,

Crox
 
CODE

Try this -

(1) Create a DOS file called CX.BAT containing this -

@ECHO OFF
REM *
REM **** Compiles .CBL source code to produce .EXE run code
REM *

@ECHO ON
\COBOL\BINB\COBOL %1.CBL,%1.OBJ,%1.LST;
@ECHO OFF
IF ERRORLEVEL 1 GOTO COBOL-FAILURE
\COBOL\BINB\LINK %1.OBJ+EXTFH /ST:4096 /SE:512,%1.EXE;
IF ERRORLEVEL 1 GOTO LINK-FAILURE
GOTO SUCCESSFUL

:COBOL-FAILURE
@ECHO OFF
ECHO ***********************
ECHO **** COBOL-FAILURE **** %1
ECHO ***********************
GOTO FINISH

:LINK-FAILURE
@ECHO OFF
ECHO **********************
ECHO **** LINK-FAILURE **** %1
ECHO **********************
GOTO FINISH

:SUCCESSFUL
@ECHO OFF
ECHO ********************
ECHO **** SUCCESSFUL **** %1.CBL ---> %1.EXE
ECHO ********************
GOTO FINISH

:FINISH
@ECHO OFF


(2) To compile a program called XYZ.CBL,
at the DOS prompt type in -
CX XYZ

(3) If you've got syntax errors, look inside XYZ.LST
to see what they are.

(4) I've assumed \COBOL\BINB is what you have installed.

(5) Extra tip : Use Microsoft editor called M.EXE to
make coding easier.

/CODE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top