For Programmers: Free Programming Magazines  


Home > Archive > Cobol > July 2007 > Batch compiling Fujitsu COBOL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Batch compiling Fujitsu COBOL
Pete Dashwood

2007-07-29, 9:55 pm

I may need to compile a bunch of COBOL programs written in Fujitsu NetCOBOL.

(They are modules of source code produced by a generator I am building.)

I've read Chapter 3 of the Users' Guide and the process is fairly straight
forward, however, I need to wrap this so an end User can do it. I therefore
need to provide a script or Windows Console that will let a series of file
names be specified (I think a textfile with a list of file names would be
), with options and outputs etc.

Before I go and write this, I was wondering of anyone has such a tool they'd
be prepared to share?

Alternatively, if I produce it, would anybody like a copy :-)?

Pete

--
"I used to write COBOL...now I can do anything."


Richard

2007-07-30, 3:55 am

On Jul 30, 2:02 pm, "Pete Dashwood"
<dashw...@removethis.enternet.co.nz> wrote:
> I may need to compile a bunch of COBOL programs written in Fujitsu NetCOBOL.
>
> (They are modules of source code produced by a generator I am building.)
>
> I've read Chapter 3 of the Users' Guide and the process is fairly straight
> forward, however, I need to wrap this so an end User can do it. I therefore
> need to provide a script or Windows Console that will let a series of file
> names be specified (I think a textfile with a list of file names would be
> ), with options and outputs etc.
>
> Before I go and write this, I was wondering of anyone has such a tool they'd
> be prepared to share?
>
> Alternatively, if I produce it, would anybody like a copy :-)?
>
> Pete
>
> --
> "I used to write COBOL...now I can do anything."



'make' works for MS Windows version of Fujitsu 6. It should be OK with
7. In fact the project generates a makefile and then runs this. You
should be able to pick this out and construct your own makefile. The
advantage is that it will work out dependencies and compile whatever
is needed.





Pete Dashwood

2007-07-30, 3:55 am



"Richard" <riplin@Azonic.co.nz> wrote in message
news:1185771148.405673.243830@m37g2000prh.googlegroups.com...
> On Jul 30, 2:02 pm, "Pete Dashwood"
> <dashw...@removethis.enternet.co.nz> wrote:
>
>
> 'make' works for MS Windows version of Fujitsu 6. It should be OK with
> 7. In fact the project generates a makefile and then runs this. You
> should be able to pick this out and construct your own makefile. The
> advantage is that it will work out dependencies and compile whatever
> is needed.
>
>

That's a good idea. Thanks, Richard.

There won't be any dependencies between these modules, and my initial
thought was to simply compile and link them, producing a series of .EXEs

I never thought about using MAKE. It might be possible to combine each batch
of these programs into a single Library, and that would have a number of
advantages later in the process (Not to mention packaging).

I'll think about doing something with MAKE.

Cheers,

Pete.

--
"I used to write COBOL...now I can do anything."


tleaders...gmail.com

2007-07-30, 6:55 pm


Pete

I use a dos batch file to compile my programs. After the batch is run
any program will an error will have a file filename.ERR, that contains
all the error messaages.


ECHO OFF
IF EXIST %1.ERR. (DEL %1.ERR)
IF EXIST %1.EXE. (DEL %1.EXE)
IF EXIST %1.LST. (DEL %1.LST)
IF EXIST %1.PDB. (DEL %1.PDB)
del %1.exe
SET COB_OPTIONS=cobol.cbi
CALL "COBOLC.EXE" %1.CBL /WC:SRF(FIX,FIX) /TARGET:EXE /MAIN:%1 /PRINT:
%1.ERR /REFERENCE:\TLL\FILE_SYSTEM.DLL /copypath:\TLL\LIB

IF EXIST %1.EXE. (DEL %1.ERR)


FYI
Try running cobolc /? in a dos prompt for more/other options you may
need for you system.
The file_system.dll is a vb.net application that handles all the sql
IO.


Good luck
Tom

HeyBub

2007-07-30, 6:55 pm

Pete Dashwood wrote:
> I may need to compile a bunch of COBOL programs written in Fujitsu
> NetCOBOL.
> (They are modules of source code produced by a generator I am
> building.)
> I've read Chapter 3 of the Users' Guide and the process is fairly
> straight forward, however, I need to wrap this so an end User can do
> it. I therefore need to provide a script or Windows Console that will
> let a series of file names be specified (I think a textfile with a
> list of file names would be ), with options and outputs etc.
>
> Before I go and write this, I was wondering of anyone has such a tool
> they'd be prepared to share?
>
> Alternatively, if I produce it, would anybody like a copy :-)?
>


I offered something similar some time back:

===== begin quote
So, I gussied it up:

(COMPILE.BAT)


@ECHO OFF
C:
CD \C-SOURCE
IF EXIST == RESULT.TXT DEL RESULT.TXT
IF EXIST == *.BLG DEL *.BLG
ECHO BEGIN COMPILATION BATCH > RESULT.TXT
FOR %%A IN (*.PPJ) DO call compile2.bat %%A
TYPE RESULT.TXT


(COMPILE2.BAT)


@ECHO OFF
ECHO Compile %1
echo === BEGIN %1 >> RESULT.TXT
POWERCOB /REBUILD %1
IF ERRORLEVEL 1 GOTO FAIL
GOTO OK


:FAIL
ECHO . >> RESULT.TXT
ECHO !!! E R R O R I N %1 !!! >> RESULT.TXT
ECHO . >> RESULT.TXT


:OK
TYPE *.BLG >> RESULT.TXT
DEL *.BLG /Q
echo === END %1 >> result.txt
ECHO =============================== >> RESULT.TXT
ECHO =============================== >> RESULT.TXT
ECHO . >> RESULT.TXT
ECHO . >> RESULT.TXT


====== end quote

To which you replied:

=== begin quote

Cool! (in a 1980s kind of way...:-))


These days it should be a WSH script, but, Hey, if it works...and it
obviously does.

=== end quote

The above might be a starting point.... (in a 1980's kind of way)


Pete Dashwood

2007-07-30, 6:55 pm


"tleaders...gmail.com" <tleaders@gmail.com> wrote in message
news:1185801886.552807.6300@x40g2000prg.googlegroups.com...
>
> Pete
>
> I use a dos batch file to compile my programs. After the batch is run
> any program will an error will have a file filename.ERR, that contains
> all the error messaages.
>

That's a nice touch.

>
> ECHO OFF
> IF EXIST %1.ERR. (DEL %1.ERR)
> IF EXIST %1.EXE. (DEL %1.EXE)
> IF EXIST %1.LST. (DEL %1.LST)
> IF EXIST %1.PDB. (DEL %1.PDB)
> del %1.exe
> SET COB_OPTIONS=cobol.cbi
> CALL "COBOLC.EXE" %1.CBL /WC:SRF(FIX,FIX) /TARGET:EXE /MAIN:%1 /PRINT:
> %1.ERR /REFERENCE:\TLL\FILE_SYSTEM.DLL /copypath:\TLL\LIB
>
> IF EXIST %1.EXE. (DEL %1.ERR)
>
>
> FYI
> Try running cobolc /? in a dos prompt for more/other options you may
> need for you system.


Chapter 3 of the Fujitsu User Guide fully documents all the compiler and
linker options available.

It took a few years, but Fujitsu finally got their documentation into shape
and what they have now is useful and clear.

> The file_system.dll is a vb.net application that handles all the sql
> IO.
>
>
> Good luck


Thanks! I'm hoping I won't need it... :-)
> Tom
>

Thanks for posting the batch file, Tom. It brought back some happy memories
:-)

I haven't written any DOS Batch files for many years now, but I agree it is
a simple and effective solution.

I'm still thinking about how to integerate whatever I decide on with the
rest of my solution and DOS does not fit too well.

I'll either wrap it as a DotNET desktop solution (in C#) or use Windows
Script Hosting (which is the modern replacement for Batch files).

Nevertheless, I appreciate you taking the time to post, and it was
interesting looking through the Batch file.

Thanks.

Pete.


Pete Dashwood

2007-07-30, 6:55 pm



"HeyBub" <heybubNOSPAM@gmail.com> wrote in message
news:13arre07kgak87f@news.supernews.com...
> Pete Dashwood wrote:
>
> I offered something similar some time back:
>
> ===== begin quote
> So, I gussied it up:
>
> (COMPILE.BAT)
>
>
> @ECHO OFF
> C:
> CD \C-SOURCE
> IF EXIST == RESULT.TXT DEL RESULT.TXT
> IF EXIST == *.BLG DEL *.BLG
> ECHO BEGIN COMPILATION BATCH > RESULT.TXT
> FOR %%A IN (*.PPJ) DO call compile2.bat %%A
> TYPE RESULT.TXT
>
>
> (COMPILE2.BAT)
>
>
> @ECHO OFF
> ECHO Compile %1
> echo === BEGIN %1 >> RESULT.TXT
> POWERCOB /REBUILD %1
> IF ERRORLEVEL 1 GOTO FAIL
> GOTO OK
>
>
> :FAIL
> ECHO . >> RESULT.TXT
> ECHO !!! E R R O R I N %1 !!! >> RESULT.TXT
> ECHO . >> RESULT.TXT
>
>
> :OK
> TYPE *.BLG >> RESULT.TXT
> DEL *.BLG /Q
> echo === END %1 >> result.txt
> ECHO =============================== >> RESULT.TXT
> ECHO =============================== >> RESULT.TXT
> ECHO . >> RESULT.TXT
> ECHO . >> RESULT.TXT
>
>
> ====== end quote
>
> To which you replied:
>
> === begin quote
>
> Cool! (in a 1980s kind of way...:-))
>
>
> These days it should be a WSH script, but, Hey, if it works...and it
> obviously does.
>
> === end quote
>
> The above might be a starting point.... (in a 1980's kind of way)
>
>

Thanks Jerry. I stand chastised... :-)

It is pretty clear what I need to do, I was just trying to save myself the
time doing it :-)

I apologise unreservedly for being dismissive of your solution (although I
did appreciate the elegance of the Batch file). I really don't want to
deliver DOS Batch technology in 2007. The rest of the solution is
"state-of-the-art" so the mundane housekeeping needs to be also.

However, I really appreciate the fact that people have responded with
various solutions and if I was stuck for knowing where to start, I certainly
wouldn't be any more.

I think Richard's suggestion of using MAKE is a very good one and it is
something I had completely overlooked. As I'm sure you know, the Fujitsu
Project Manager generates MAKE files for a project and it is quite an
elegant solution.

Whatever I end up with, I will make available to the community here, in
appreciation of the posts received.

Pete.
--
"I used to write COBOL...now I can do anything."


HeyBub

2007-07-31, 6:55 pm

Pete Dashwood wrote:
> Thanks Jerry. I stand chastised... :-)
>
> It is pretty clear what I need to do, I was just trying to save
> myself the time doing it :-)
>
> I apologise unreservedly for being dismissive of your solution
> (although I did appreciate the elegance of the Batch file). I really
> don't want to deliver DOS Batch technology in 2007. The rest of the
> solution is "state-of-the-art" so the mundane housekeeping needs to
> be also.


No apology needed.

An engineer and a mathematician, who both know how to drink from a cup, are
confronted with a water fountain.

The engineer studies the problem for a moment, then bends over and has a
refreshing drink.

The mathematician studies the problem for a moment... and fills his cup!

Engineers are taught to solve new problems directly; mathematicians are
taught to reduce a new problem to one that has already been solved.

You're an engineer; I'm the other kind. It's the result that counts.


Pete Dashwood

2007-07-31, 6:55 pm



"HeyBub" <heybubNOSPAM@gmail.com> wrote in message
news:13aun1541h6hga6@news.supernews.com...
> Pete Dashwood wrote:
>
> No apology needed.
>
> An engineer and a mathematician, who both know how to drink from a cup,
> are confronted with a water fountain.
>
> The engineer studies the problem for a moment, then bends over and has a
> refreshing drink.
>
> The mathematician studies the problem for a moment... and fills his cup!
>
> Engineers are taught to solve new problems directly; mathematicians are
> taught to reduce a new problem to one that has already been solved.
>
> You're an engineer; I'm the other kind. It's the result that counts.


A very analogy. I think some days I'm more engineer and other days more
mathematician. :-)

I imagine that's probably true for most of us. As you say, it is the result
that matters.

Pete.

--
"I used to write COBOL...now I can do anything."


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com