bug-gnucobol
[Top][All Lists]
Advanced

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

Re: GnuCOBOL version 3 issue CALL


From: Brian Tiffin
Subject: Re: GnuCOBOL version 3 issue CALL
Date: Fri, 20 Mar 2020 17:38:41 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.5

James Smith wrote:
> Relevant stats below:
>
> cobc (GnuCOBOL) 3.0-rc1.0
> Copyright (C) 2018 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward
> Hart
> Built     May 08 2019 08:12:29
> Packaged  Apr 22 2018 22:26:54 UTC
> C version "7.4.0"
> j
>
> Report bugs to: address@hidden
> or (preferably) use the issue tracker via the home page.
> GnuCOBOL home page: <http://www.gnu.org/software/gnucobol/>
> General help using GNU software: <http://www.gnu.org/gethelp/>
> Linux Mint 19.3 Tricia x86_64 on a newish Acer Aspire desktop machine.
>
> I am aware that I am using a pre-release version of GnuCOBOL. I am
> willingly taking the responsibility for some failures. My background is
> primarily mainframe COBOL programmer since 1970, now retired. The various
> COBOL implementations I have used include; IBM from pre-1974 through COBOL
> II, Ryan-McFarland on PCs, NCR IRX, Unisys, and DEC Vax/Alpha machines. I
> retired in 2008 but I missed COBOL so much that I have taken up with your
> implementation. I am using version 3 because I liked the Report Writer
> feature. It works nicely.
>
> My issue is a strange one.
>
> I am experimenting with COBOL CALLs to other COBOL modules. I am
> experimenting to learn the ins-and-outs of how GnuCOBOL operates. Sometimes
> everything works fine, at other times not so much. For example, I have one
> program that is to run as a CALLed program within another. Let's identify
> them as "MainScreen" and "PGM00". When I compile "MainScreen" alone it
> compiles clean.
>
> james@Aspire:~/cobolsandbox/contributions$ cobc -free -Xref -v -x -W -T
> MainScreen.lst -o MainScreen MainScreen.cbl
> cobc (GnuCOBOL) 3.0-rc1.0
> Built     May 08 2019 08:12:29 Packaged  Apr 22 2018 22:26:54 UTC
> C version "7.4.0"
> loading standard configuration file 'default.conf'
> command line: cobc -free -Xref -v -x -W -T MainScreen.lst -o MainScreen
> MainScreen.cbl
> preprocessing: MainScreen.cbl -> ./cob28336_0.cob
> return status: 0
> parsing: ./cob28336_0.cob (MainScreen.cbl)
> return status: 0
> translating: ./cob28336_0.cob -> ./cob28336_0.c (MainScreen.cbl)
> executing: gcc -c -I/usr/local/include -Wno-unused -fsigned-char
> -Wno-pointer-sign -pipe -o "./cob28336_0.o" "./cob28336_0.c"
> return status: 0
> executing: gcc -Wl,--export-dynamic -o "MainScreen" "./cob28336_0.o"
> -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb-5.3 -ldl
> return status: 0
>
> Then when I compile the subprogram, it also compiles clean.
>
> james@Aspire:~/cobolsandbox/contributions$ cobc -free -Xref -v -x -W -T
> PGM00.lst -o PGM00 PGM00.cbl
> cobc (GnuCOBOL) 3.0-rc1.0
> Built     May 08 2019 08:12:29 Packaged  Apr 22 2018 22:26:54 UTC
> C version "7.4.0"
> loading standard configuration file 'default.conf'
> command line: cobc -free -Xref -v -x -W -T PGM00.lst -o PGM00 PGM00.cbl
> preprocessing: PGM00.cbl -> ./cob28384_0.cob
> return status: 0
> parsing: ./cob28384_0.cob (PGM00.cbl)
> return status: 0
> translating: ./cob28384_0.cob -> ./cob28384_0.c (PGM00.cbl)
> executing: gcc -c -I/usr/local/include -Wno-unused -fsigned-char
> -Wno-pointer-sign -pipe -o "./cob28384_0.o" "./cob28384_0.c"
> return status: 0
> executing: gcc -Wl,--export-dynamic -o "PGM00" "./cob28384_0.o"
> -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb-5.3 -ldl
> return status: 0
>
> Running the MainScreen program initially seems fine. Then, when I close
> that program, the "module not found" error shows.
>
> james@Aspire:~/cobolsandbox/contributions$ ./MainScreen
> libcob: module 'PGM00' not found
> libcob:  warning: implicit CLOSE of Log-File
> ('/home/james/cobolsandbox/contributions/logs/main.log')
>
> I have tried numerous variations of the CALL with disturbingly uniform
> failures.
>
> Here is the latest I am trying:
> 01  WS-Pgm-To-Call-Top.
>     05                        PIC X(39) VALUE
>         "/home/james/cobolsandbox/contributions/".
>     05  WS-Pgm-To-Call        PIC X(10) VALUE "PGM00     ".
> ***
> PROCEDURE DIVISION.
> *>------------------------------------------------
> 000-Main.
>     MOVE "Now CALLing PGM00." TO SS-Message-Line-18. *>displays
> *>    CALL "./PGM00" END-CALL.                       *>Nope
>     MOVE "./PGM00" TO WS-Pgm-To-Call.
> *>    CALL WS-Pgm-To-Call END-CALL.                  *>Nope
>     CALL "SYSTEM" USING WS-Pgm-To-Call-Top END-CALL.
>
> When I try to compile all in one compilation unit, the program that
> compiles clean when alone, causes the process to fail with many errors.
>
> cobc (GnuCOBOL) 3.0-rc1.0
> Built     May 08 2019 08:12:29 Packaged  Apr 22 2018 22:26:54 UTC
> C version "7.4.0"
> loading standard configuration file 'default.conf'
> command line: cobc -free -Xref -v -x -W -T MainScreen.lst -o MainScreen
> MainScreen.cbl PGM00 createPIDX.cbl Contributions.cbl rptPIDX.cbl
> PCSV2PIDX.cbl createTIDX.cbl
> preprocessing: MainScreen.cbl -> ./cob28690_0.cob
> return status: 0
> parsing: ./cob28690_0.cob (MainScreen.cbl)
> return status: 0
> translating: ./cob28690_0.cob -> ./cob28690_0.c (MainScreen.cbl)
> executing: gcc -c -I/usr/local/include -Wno-unused -fsigned-char
> -Wno-pointer-sign -pipe -o "./cob28690_0.o" "./cob28690_0.c"
> return status: 0
> preprocessing: PGM00 -> ./cob28690_1.cob
> PGM00:2: warning: source text exceeds 512 bytes, will be truncated
> PGM00:2: warning: source text exceeds 512 bytes, will be truncated
> PGM00:3: warning: source text exceeds 512 bytes, will be truncated
> PGM00:5: warning: source text exceeds 512 bytes, will be truncated
> PGM00:6: warning: source text exceeds 512 bytes, will be truncated
> PGM00:9: warning: source text exceeds 512 bytes, will be truncated
> PGM00:10: warning: source text exceeds 512 bytes, will be truncated
> PGM00:11: warning: source text exceeds 512 bytes, will be truncated
> PGM00:14: warning: source text exceeds 512 bytes, will be truncated
> PGM00:19: warning: source text exceeds 512 bytes, will be truncated
> PGM00:23: warning: source text exceeds 512 bytes, will be truncated
> PGM00:24: warning: source text exceeds 512 bytes, will be truncated
> PGM00:25: warning: source text exceeds 512 bytes, will be truncated
> PGM00:26: warning: source text exceeds 512 bytes, will be truncated
> PGM00:27: warning: source text exceeds 512 bytes, will be truncated
> PGM00:31: warning: source text exceeds 512 bytes, will be truncated
> return status: 0
> parsing: ./cob28690_1.cob (PGM00)
> PGM00:1: error: invalid symbol '' - skipping word
> PGM00:1: error: PROGRAM-ID header missing
> PGM00:1: error: ENVIRONMENT DIVISION header missing
> PGM00:1: error: CONFIGURATION SECTION header missing
> PGM00:1: error: SPECIAL-NAMES header missing
> PGM00:1: error: invalid system-name '������'
> PGM00:1: error: invalid symbol '%' - skipping word
> PGM00:1: error: syntax error, unexpected &, expecting CRT or Identifier
> PGM00:1: error: invalid system-name '�'
> PGM00:1: error: invalid symbol '
>                                 ' - skipping word
> PGM00:1: error: syntax error, unexpected end of file, expecting CRT or
> Identifier
> PGM00:1: error: syntax error, unexpected end of file
> return status: 1
> preprocessing: createPIDX.cbl -> ./cob28690_2.cob
> return status: 0
> parsing: ./cob28690_2.cob (createPIDX.cbl)
> return status: 0
> preprocessing: Contributions.cbl -> ./cob28690_3.cob
> return status: 0
> parsing: ./cob28690_3.cob (Contributions.cbl)
> return status: 0
> preprocessing: rptPIDX.cbl -> ./cob28690_4.cob
> return status: 0
> parsing: ./cob28690_4.cob (rptPIDX.cbl)
> return status: 0
> preprocessing: PCSV2PIDX.cbl -> ./cob28690_5.cob
> return status: 0
> parsing: ./cob28690_5.cob (PCSV2PIDX.cbl)
> return status: 0
> preprocessing: createTIDX.cbl -> ./cob28690_6.cob
> return status: 0
> parsing: ./cob28690_6.cob (createTIDX.cbl)
> return status: 0
>
> Help me, Obi Wan Cutler (or whomever...). You're my only hope.
>
> Seriously, let me know what I should send if I have not given enough to
> work with. Thank you in advance. I am really enjoying using your product
> even with these hiccups.
>
>

Long one, James, but a short, first step answer is to try

cobc -free -Xref -v -x -W -T MainScreen.lst -o MainScreen MainScreen.cbl
PGM00.cbl createPIDX.cbl Contributions.cbl rptPIDX.cbl

Note, the only change is PGM00 to PGM00.cbl (it was trying to compile
the binary module as source code).

We can discuss more about the ins and outs of dynamic linking both at
compile time and run-time if needs be, but take a look at

https://open-cobol.sourceforge.io/faq/index.html#how-does-the-gnucobol-compiler-work

https://open-cobol.sourceforge.io/faq/index.html#why-can-t-libcob-find-my-link-modules-at-run-time
 
(and the four topics linked at the bottom of that blurb)

Have good, make well,
Blue




reply via email to

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