For Programmers: Free Programming Magazines  


Home > Archive > Cobol > July 2004 > C-preprocessor for 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 C-preprocessor for COBOL?
Herwig Huener

2004-07-05, 8:55 am

2004-07-05 12:00:00 MEST

This is not supposed to be a joke.

The C-preprocessor which can be used quite
independent of C, at least in the Unix-Environment,
can be used for other languages than C - it can
even be used for poetry and such.

Now, in the old days, when COBOL did not have
conditional compilation, you could, for instance,
"misuse" the C-preprocessor to have conditional
compilation. Also, at least some of the other
capabilities of the C-preprocessor could also be
used, if one dares to do so.

Does anyone know, whether there are/were serious
projects where this was regulary done?

Herwig


Warren Simmons

2004-07-05, 3:55 pm

Herwig Huener wrote:
> 2004-07-05 12:00:00 MEST
>
> This is not supposed to be a joke.
>
> The C-preprocessor which can be used quite
> independent of C, at least in the Unix-Environment,
> can be used for other languages than C - it can
> even be used for poetry and such.
>
> Now, in the old days, when COBOL did not have
> conditional compilation, you could, for instance,
> "misuse" the C-preprocessor to have conditional
> compilation. Also, at least some of the other
> capabilities of the C-preprocessor could also be
> used, if one dares to do so.
>
> Does anyone know, whether there are/were serious
> projects where this was regulary done?
>
> Herwig
>
>

Herwig,

I would contact the Tiny COBOL project. Their
'85 compiler is built on C, and they have
first hand experiences that might help.

Warren Simmons
Herwig Huener & Josella Simone Playton

2004-07-05, 3:55 pm

2004-07-05 21:01:20 MEST

Warren Simmons wrote:

> ...
>
> I would contact the Tiny COBOL project. Their
> '85 compiler is built on C, and they have
> first hand experiences that might help.


That is not quite what I had in my mind.

Of course a COBOL-compiler may generate C rather than
some machine code, and it may be possible to translate
some of the COBOL-directives of the new COBOL standard into
C-preprocessor commands - we never did an investigation
on this idea, maybe there are difficulties which are
not easily overcome - but what I am thinking about
is this kind of language-mixture:

#define BLUBH

#ifdef BLUBH
display "Mixed language conditional compilation!"
upon tv.
#else
this is never compiled ...
#endif

This requires a C-Preprocessor and then a COBOL-compiler.

Actually you are right on one thing: It is ages ago
that I looked the last time on the pages of the Tiny
COBOL Project - so they still exist? I had the impression
that some of the team members lost interest on
that project, and so, then, did I.

Herwig

--
Herwig Huener http://www.quantenrente.de +49
Josella Simone http://www.Josella-Simone-Playton.de 8095
Playton webmaster!@!Herwig-Huener.de 2230
GruberStrasse 10 A / D-85655 GrossHelfenDorf / Bayern / EU

Richard

2004-07-05, 8:55 pm

"Herwig Huener" <Herwig.Huener@fujitsu-siemens.com> wrote

> The C-preprocessor which can be used quite
> independent of C, at least in the Unix-Environment,
> can be used for other languages than C - it can
> even be used for poetry and such.


I am not convinced that the C preprocessor would be much use for
Cobol. For example it recognises C's commenting but not Cobol's.

> Now, in the old days, when COBOL did not have
> conditional compilation, you could, for instance,
> "misuse" the C-preprocessor to have conditional
> compilation.


In the 'old days' few mainframes had C compilers (or C preprocessors)
and Unix machines did not do much Cobol.

> Also, at least some of the other
> capabilities of the C-preprocessor could also be
> used, if one dares to do so.


Maybe, but it isn't hard to write a preprocessor that can more easily
handle Cobol source, I have written a few.

> Does anyone know, whether there are/were serious
> projects where this was regulary done?

Warren Simmons

2004-07-06, 3:55 am

Herwig Huener & Josella Simone Playton wrote:
> 2004-07-05 21:01:20 MEST
>
> Warren Simmons wrote:
>
>
>
> That is not quite what I had in my mind.
>
> Of course a COBOL-compiler may generate C rather than
> some machine code, and it may be possible to translate
> some of the COBOL-directives of the new COBOL standard into
> C-preprocessor commands - we never did an investigation
> on this idea, maybe there are difficulties which are
> not easily overcome - but what I am thinking about
> is this kind of language-mixture:
>
> #define BLUBH
>
> #ifdef BLUBH
> display "Mixed language conditional compilation!"
> upon tv.
> #else
> this is never compiled ...
> #endif
>
> This requires a C-Preprocessor and then a COBOL-compiler.
>
> Actually you are right on one thing: It is ages ago
> that I looked the last time on the pages of the Tiny
> COBOL Project - so they still exist? I had the impression
> that some of the team members lost interest on
> that project, and so, then, did I.
>
> Herwig
>

Well, I only think I know what they are doing, but
I believe their compiler is written in C, and they
use a specific this and that to do parsing. Talk to
them. They are still in business, and doing well.
They even have follow on product plans. Some of
the people seem to have to go for awhile but show
up when there is a question or problem to be solved.

It's a suggestion only. I am not a part of the team
but a regular reader of their news letters.

Warren
Herwig Huener

2004-07-06, 8:55 am

2004-07-06 11:55:55 MESZ

"Richard" <riplin@Azonic.co.nz> schrieb:

> ...


>
> Maybe, but it isn't hard to write a preprocessor that can more easily
> handle Cobol source, I have written a few.


So did I - preprocessor for natural language, I mean.
Everybody should write a few preprocessors in a
lifetime - it's great fun - and after having played
with it a while, one finds out that emacs can do
the job just as well.

fun aside: If one writes a preprocessor for purposes
of conditional compilation for a language that has
not (yet) such a thing, one must also invent a suitable
notation - a mini-programming language, so to say.

OK - everybody should invent a new programming-language,
now and then, in a life time - it's great fun.

Herwig



William M. Klein

2004-07-06, 3:55 pm

Herwig,
I used to hear "urban legends" of IBM mainframe shops where they used the
PL/I "macro processor" to preprocess COBOL code. There was also a 3rd party
"vendor product" called META-COBOL which did something similar.

Personally, I never heard of the C preprocessor being used that way (and I would
think that during my years at Micro Focus, I would have heard of this if it was
done). OTOH, maybe someone did do such things somewhere. <G>

--
Bill Klein
wmklein <at> ix.netcom.com
"Herwig Huener" <Herwig.Huener@fujitsu-siemens.com> wrote in message
news:ccb8qe$et$1@nntp.fujitsu-siemens.com...
> 2004-07-05 12:00:00 MEST
>
> This is not supposed to be a joke.
>
> The C-preprocessor which can be used quite
> independent of C, at least in the Unix-Environment,
> can be used for other languages than C - it can
> even be used for poetry and such.
>
> Now, in the old days, when COBOL did not have
> conditional compilation, you could, for instance,
> "misuse" the C-preprocessor to have conditional
> compilation. Also, at least some of the other
> capabilities of the C-preprocessor could also be
> used, if one dares to do so.
>
> Does anyone know, whether there are/were serious
> projects where this was regulary done?
>
> Herwig
>
>



Herwig Huener & Josella Simone Playton

2004-07-06, 8:55 pm

2004-07-07 00:04:00 MESZ

William M. Klein wrote:

> I used to hear "urban legends" of IBM mainframe shops where they used the
> PL/I "macro processor" to preprocess COBOL code. There was also a 3rd party
> "vendor product" called META-COBOL which did something similar.


Although I work, at times, on an ESQL-PreCompiler for COBOL,
I am not a friend of preprocessors. Language concepts
get blurred, and one always must keep in mind in which order
different preprocessors shall be applied.

But the need of some Preprocessing tends to surface now
and then - and one could even claim that the
Unix-philosophy - different programms communicating with
each other via pipe-connection - is nothing else than a
repeated application of the preprocessor-concept,
taken to the extreme.

Surprisingly, for little ad-hoc jobs, you oftenly get
a lot of work done in one cute little command-line.

Herwig

--
Herwig Huener http://www.quantenrente.de +49
Josella Simone http://www.Josella-Simone-Playton.de 8095
Playton webmaster!@!Herwig-Huener.de 2230
GruberStrasse 10 A / D-85655 GrossHelfenDorf / Bayern / EU

Arnold Trembley

2004-07-07, 3:55 am



William M. Klein wrote:
> Herwig,
> I used to hear "urban legends" of IBM mainframe shops where they used the
> PL/I "macro processor" to preprocess COBOL code. There was also a 3rd party
> "vendor product" called META-COBOL which did something similar.


My shop still has old "copybooks" on file that were used by the CICS
1.6.1 MACRO preprocessor to generate COBOL code. That use the macro
capabilities of the IBM mainframe assembler. Some of these things
generate COBOL copybooks, ID division headers, and even procedure
division code without any Macro-level CICS calls.

Of course, that stuff is completely out of date, since Macro-Level
CICS has been off support for years.

Just for playing around, I wrote an HLASM macro to generate a skeleton
COBOL batch program with variable options for including copybooks,
record length, program name, et cetera. It was fun, but I am NO
expert on HLASM macro coding.

--
http://arnold.trembley.home.att.net/


Warren Simmons

2004-07-07, 3:55 am

Arnold Trembley wrote:
>
>
> William M. Klein wrote:
>
>
>
> My shop still has old "copybooks" on file that were used by the CICS
> 1.6.1 MACRO preprocessor to generate COBOL code. That use the macro
> capabilities of the IBM mainframe assembler. Some of these things
> generate COBOL copybooks, ID division headers, and even procedure
> division code without any Macro-level CICS calls.
>
> Of course, that stuff is completely out of date, since Macro-Level CICS
> has been off support for years.
>
> Just for playing around, I wrote an HLASM macro to generate a skeleton
> COBOL batch program with variable options for including copybooks,
> record length, program name, et cetera. It was fun, but I am NO expert
> on HLASM macro coding.
>

The Meta COBOL product was written and supported by Steve Wright. Not the
commody guy, but our support after U 1 class. He also wrote the Matrix
Math package for Univac. We set up one person to create Meta COBOL
stuff for the programming staff. It, in my opinion, would make a great
java for COBOL. I don't know if Steve is still alive, or if the firm he
was with still supports the software. I doubt it.

Warren Simmons
Bernard Giroud

2004-07-07, 3:55 am

Herwig Huener a écrit :

> 2004-07-06 11:55:55 MESZ
>
> "Richard" <riplin@Azonic.co.nz> schrieb:
>
>
>
> So did I - preprocessor for natural language, I mean.
> Everybody should write a few preprocessors in a
> lifetime - it's great fun - and after having played
> with it a while, one finds out that emacs can do
> the job just as well.
>
> fun aside: If one writes a preprocessor for purposes
> of conditional compilation for a language that has
> not (yet) such a thing, one must also invent a suitable
> notation - a mini-programming language, so to say.
>


Conditional compilation is fine with the C preprocessor:
I used it to control the generation of a Postscript driver.
But as you said, conditional is already in COBOL,
and I agree with Richard for areas like commenting
and mostly way of "calling" preprocessing functions.

BTW, yes TC is still alive, although some of us can't
spend too much time on it. Life is hard these days !
Too many mergers, and too many programmers on
the market...

>
> OK - everybody should invent a new programming-language,
> now and then, in a life time - it's great fun.
>
> Herwig


--
Bernard Giroud
Open Source COBOL Tools Developer


Bernard Giroud

2004-07-07, 3:55 am

Another little thought: m4 would be much more
appropriate for complex tasks (a little like the
DELTA generator).

--
Bernard Giroud
Open Source COBOL Tools Developer


Herwig Huener & Josella Simone Playton

2004-07-07, 8:55 am

2004-07-07 12:12:12 MESZ

Arnold Trembley wrote:

> ...


> Just for playing around, I wrote an HLASM macro to generate a skeleton
> COBOL batch program with variable options for including copybooks,
> record length, program name, et cetera. It was fun, but I am NO expert
> on HLASM macro coding.


I remember another "misuse" of a Unix-Tool for COBOL.

Some time ago, I worked on the conditional compilation
for the new COBOL-standard. There, I needed
test-programs - huge testprograms with intricate nested
levels of conditional compilation which should present
a real challenge for our COBOL-compiler.

No one can write a test-program of, say, 10000 lines
and have it right the first time.

So what I did is I wrote a bash-script which generates
all of the COBOL-testprogram: the expressions within the
directives, the thousands of lines such as

display "this must not be compiled" upon tv.
add 1 to error-counter.

and so on.

This approach worked well - I learned more bash than
COBOL that way.

This task was easy. Not so easy is another thing which
we considered ages ago, in the Ada-compiler-projekt:
Make a Pseudo-Random-Number-generator and have the
random numbers select language elements and their
composition in order to create great test-programs
for a compiler. I do not yet have an easy
script-solution for this - it might require a hell lot
of time to do this.

Herwig

--
Herwig Huener http://www.quantenrente.de +49
Josella Simone http://www.Josella-Simone-Playton.de 8095
Playton webmaster!@!Herwig-Huener.de 2230
GruberStrasse 10 A / D-85655 GrossHelfenDorf / Bayern / EU

Herwig Huener & Josella Simone Playton

2004-07-07, 3:56 pm

2004-07-07 18:42:35 MEST

Herwig Huener wrote himself:

For those who might be :

> ...
>
> So what I did is I wrote a bash-script which generates ...


It just occured to me that "bash" is a valid English
word with an out-of-context meaning. I was talking about
the "Bourne-Again-Shell", short "bash". I was not
talking about bashing someone.

The English language has some pitfalls ...

Herwig

--
Herwig Huener http://www.quantenrente.de +49
Josella Simone http://www.Josella-Simone-Playton.de 8095
Playton webmaster!@!Herwig-Huener.de 2230
GruberStrasse 10 A / D-85655 GrossHelfenDorf / Bayern / EU

JerryMouse

2004-07-07, 3:56 pm

Herwig Huener & Josella Simone Playton wrote:
> It just occured to me that "bash" is a valid English
> word with an out-of-context meaning. I was talking about
> the "Bourne-Again-Shell", short "bash". I was not
> talking about bashing someone.
>
> The English language has some pitfalls ...


That's why most of us speak COBOL.


Herwig Huener & Josella Simone Playton

2004-07-07, 8:55 pm

22:55:33 MESZ

JerryMouse wrote:

> ...


>
>
> That's why most of us speak COBOL.


In COBOL, you get used to "noise words". If you
use noise words in C, you call a library function
you never heard about before. Neither has anyone
else ...

Herwig

--
Herwig Huener http://www.quantenrente.de +49
Josella Simone http://www.Josella-Simone-Playton.de 8095
Playton webmaster!@!Herwig-Huener.de 2230
GruberStrasse 10 A / D-85655 GrossHelfenDorf / Bayern / EU

Warren Simmons

2004-07-08, 3:55 am

Herwig Huener & Josella Simone Playton wrote:
> 22:55:33 MESZ
>
> JerryMouse wrote:
>
>
>
>
> In COBOL, you get used to "noise words". If you
> use noise words in C, you call a library function
> you never heard about before. Neither has anyone
> else ...
>
> Herwig
>

Come to think of it, the TC group may have used BASH.
I remember reading about the task of reading the source code,
buyt at my age, I don't usually keep things straight for long.

Warren Simmons
LX-i

2004-07-09, 3:55 am

Herwig Huener & Josella Simone Playton wrote:
> 2004-07-07 18:42:35 MEST
>
> Herwig Huener wrote himself:
>
> For those who might be :
>
>
>
> It just occured to me that "bash" is a valid English
> word with an out-of-context meaning. I was talking about
> the "Bourne-Again-Shell", short "bash". I was not
> talking about bashing someone.


Most folks around here knew what you were talking about, I'd venture to
say... We (or at least I, anyway) took you for a Linux-er, not a
violent felon. ;)


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
~ / \ / ~ Live from Montgomery, AL! ~
~ / \/ o ~ ~
~ / /\ - | ~ LXi0007@Netscape.net ~
~ _____ / \ | ~ http://www.knology.net/~mopsmom/daniel ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ I do not read e-mail at the above address ~
~ Please see website if you wish to contact me privately ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
Sven Brueggemann

2004-07-09, 8:55 pm

"Herwig Huener" <Herwig.Huener@fujitsu-siemens.com> wrote:

Hello Herwig,

>Does anyone know, whether there are/were serious
>projects where this was regulary done?


We use GNU m4 as a preprocessor and macro languange for COBOL
programs. Not only to shortcut repeatedly used complex combinations of
cobol statements in a fail safe way but also to make source codes
environment independent (character vs. GUI, ISAM vs. DBMS) without too
much implications on run time performance.

Is your question just based on academic (historic?) interest or are
you actually planning to use a preprocessor with COBOL?

Kind regards

Sven
Herwig Huener & Josella Simone Playton

2004-07-09, 8:55 pm

2004-07-10 01:35:00 MESZ

Sven Brueggemann wrote:

> ...


> Is your question just based on academic (historic?) interest or are
> you actually planning to use a preprocessor with COBOL?


Historic interest only - our COBOL on BS2000 *can*
do all those new directives.

Herwig

--
Herwig Huener http://www.quantenrente.de +49
Josella Simone http://www.Josella-Simone-Playton.de 8095
Playton webmaster!@!Herwig-Huener.de 2230
GruberStrasse 10 A / D-85655 GrossHelfenDorf / Bayern / EU

Sponsored Links







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

Copyright 2008 codecomments.com