[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnubol: COBOL and C



1. It would be a good idea if we could write much of the runtime in COBOL. Eat your
own dog food etc.

This requires an ability to mix COBOL and C, so COBOL needs to be able to look like C
functions and to call C functions.

How to do this? The problem is that the current COBOL model doesn't precisely match
the C function model. For example, there is nothing to correspond to the 'return'
value and no way to tell cobol what the return type is.

Standard COBOL 4 has all this, and I was thinking of adding this as an optional
extenstion. Good idea or not? Better ideas? One problem is avoiding name spaces
clashes between cobol and C especially the C runtime - any ideas.

Here are some examples of the syntax:

Function prototype:

identification division.
function-id. getc is prototype.
linkage section.
01 char pic s9(8) comp.
01 file-handle pic s9(8) comp.
procedure division using file-handle returning char.
end-function.

(put the prototypes in the library include directory as *.ch = cobol header).

Using a function:

identification division.
program-id. test1.
repository. using function getc. (can't remember the exact syntax of this).
data division.
working-storage section.
01 ret1 pic s9(8) comp.
01 file-handle pic s9(8) comp.
procedure division.
move function getc (file-handle) to ret1.
display "got char " ret1
exit program.

2. What is the importance of supporting-
goback (from IBM cobol)
entry (from IBM cobol, multiple entry points, not the same as 'enter')

Tim Josling


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.