gnucobol-users
[Top][All Lists]
Advanced

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

[open-cobol-list] Library "super" procedure.


From: Patrick
Subject: [open-cobol-list] Library "super" procedure.
Date: Fri, 10 May 2013 18:06:40 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Hi Brian, thanks for answering my post yesterday :)


Hi Everyone, I have another question or rather a request for feedback.

I am trying to use Cobol well outside of it's stronghold, as a business applications language.

I will need to work with a lot of C libraries and write my own wrappers..

I also want to organize my own Cobol code in the best way I can.

I really appreciate all the feedback from the "organizing code in Cobol" thread and all the other threads I started too.

I just want to expand a on things a bit.

So let's say I wanted to wrap Berkeley sockets, Termios(serial ports), libcurl or maybe sqlite etc.

At first I was thinking that I could wrap each CALL to a C function in a paragraph statement and then copy it into the program and define the arguments in working storage or possibly copy in a working storage section that had arguments laid out already.

so pseudo code....

WORKING-STORAGE DIVISION.
01 foo-arg.
   05 someString PIC X(20).
   05 someNumber PIC 9(3).

PROCEDURE DIVISION.
COPY "foo"
MOVE "BLAH" TO someString
MOVE "123" TO someNumber
PERFORM fooSomething....

etc......



This is okay but it would be nice to have all the C arguments laid out ahead of time and then I could just MOVE values to them.

I could use two copy calls but what about a "super program" that used the COMMON keyword instead:


IDENTIFICATION DIVISION .
PROGRAM-ID. foo IS COMMON PROGRAM.


If I defined all the argument variables and wrapped all the CALLS to C functions in paragraphs, would each paragraph and each variable be available to all programs linked in the same executable?

Does this seem like a sensible way to layout a binding?

I was thinking that I could also wrap CALLS to my own nested programs in paragraph statements and use them through the "super" procedure as well. I was thinking that I might be able to code things in such a way as to make some data and procedures private and some public this way.

Thanks for reading, any feedback is appreciated-Patrick





reply via email to

[Prev in Thread] Current Thread [Next in Thread]