bug-gnucobol
[Top][All Lists]
Advanced

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

Re: [Bug-GnuCOBOL] Bug-GnuCOBOL Digest, Vol 17, Issue 5


From: Michael Potter
Subject: Re: [Bug-GnuCOBOL] Bug-GnuCOBOL Digest, Vol 17, Issue 5
Date: Wed, 4 Jul 2018 22:40:44 -0400

This is what I used as a prototype for what I will do in production.

Note how I put the FUNCTION .so file in a different directory.

The key to getting it to compile is the REPOSITORY section in foo.cbl.

The key to getting it to run is pointing to that directory using COB_LIBRARY_PATH.

address@hidden tmp]$ ls -ltr
total 28
-rw-rw-r--. 1 pottmi pottmi   743 Jul  4 23:57 foo.cbl
-rw-rw-r--. 1 pottmi pottmi   322 Jul  4 23:58 UNDATE.cbl
-rw-rw-r--. 1 pottmi pottmi    90 Jul  5 00:00 compandrun.bash
drwxrwxr-x. 2 pottmi pottmi    23 Jul  5 00:01 fnc
-rwxrwxr-x. 1 pottmi pottmi 13280 Jul  5 00:01 foo.so
address@hidden tmp]$ cat compandrun.bash

cobc UNDATE.cbl
mv UNDATE.so fnc
cobc foo.cbl

export COB_LIBRARY_PATH=./fnc
cobcrun foo
address@hidden tmp]$



On Wed, Jul 4, 2018 at 2:20 PM Simon Sobisch <address@hidden> wrote:
Hi Marty,

I'll answer bottom up.
The source doesn't say END FUNCTION, it misses the I.

Concerning the dynamic module load, I guess that using COB_PRE_LOAD=update will work and that also renaming it to UPDATE.so will make it work without pre loading.

To integrate the function in the compiler: add it to reserved.c, depending on special parameters checking with a new token (in this case also change parser.y) or a generic existing one. Just follow the existing ones as sample.
Then add the runtime function in common.c, including it as extern in common.h.
Ideally you've added test cases to tests/testsuite.src before, if not do so now.

Last steps: adding ChangeLog entries and upload the beauty to the patch tracker (currently at SourceForge) or send it to the list.

Am 4. Juli 2018 19:12:47 MESZ schrieb Marty Heyman <address@hidden>:
Thanks Pat, I’m working with Michail on this. Embedding the function definition in the source works fine. At least on my raspbian system, cobcrun doesn’t seem to recognize the dynamically loadable module (update.so) in the same directory as the test file and reports it can’t find the function.

In a related manner, the following reports that the last line contains an unexpected “END” and then complains that there is no END FUNCTION line.

 
     IDENTIFICATION DIVISION.
       FUNCTION-ID. undate.

       DATA DIVISION.
       LINKAGE SECTION.
          01 not-in pic 99999 value 0.
          01 indate pic 99999.

       PROCEDURE DIVISION USING indate RETURNING not-in.
          MOVE indate TO not-in.
          EXIT FUNCTION.

       END FUNCTON undate.
~                                             

Marty Heyman (Symas)

On Jul 4, 2018, at 12:00 PM, address@hidden wrote:

Today's Topics:

  1. Re: UNDATE FUNCTION (Patrick)
  2. Re: UNDATE FUNCTION (Patrick McCavery)
----------------------------------------------------------------------

Message: 1
Date: Wed, 4 Jul 2018 08:11:39 -0400
From: Patrick <address@hidden>
To: Michael Potter <address@hidden>, address@hidden
Subject: Re: [Bug-GnuCOBOL] UNDATE FUNCTION
Message-ID: <address@hidden>
Content-Type: text/plain; charset=utf-8; format=flowed

Hi Michael

This could be added to the runtime in C but you can also add this with
user defined functions, please have a look at these:

http://opencobol.add1tocobol.com/gnucobol/#id575

http://opencobol.add1tocobol.com/guides/GNU%20COBOL%202.1%2023NOV2013%20Programmers%20Guide%20(US%20Letter).pdf


-Pat


reply via email to

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