From: charles.goodman on
I am evaluating Fujitsu NetCOBOL for Linux.
I am having problems getting CALL/CANCEL to work.
Here are two simple programs, first the main program then the called
program:

IDENTIFICATION DIVISION.
PROGRAM-ID. MYMAIN.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ACPT PIC X.
PROCEDURE DIVISION.
OPEN-PARA.
DISPLAY "BEGIN MYMAIN".
CALL 'MYSUB1'.
DISPLAY "THE END - ACCEPTING ONE BYTE".
ACCEPT ACPT.
STOP RUN.

IDENTIFICATION DIVISION.
PROGRAM-ID. MYSUB1.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ACPT PIC X.
PROCEDURE DIVISION.
OPEN-PARA.
DISPLAY "BEGIN MYSUB1 - ACCEPTING ONE BYTE".
ACCEPT ACPT.
EXIT PROGRAM.

The two source programs are saved as MYMAIN.CBL and MYSUB1.CBL.
We want dynamic linkage since our real application consists of dozens
of C programs and hundreds of COBOL programs.

I tried compiling with:
cobol -M -dy -WC,"BINARY(BYTE),DLOAD" -o MYMAIN MYMAIN.CBL
cobol -dy -shared -WC,"BINARY(BYTE)" -o libMYSUB1.so MYSUB1.CBL

when I try to execute I see my first DISPLAY and then it crashes:
BEGIN MYMAIN
cobol-rts:: HALT: JMP0015I-U [PID:0000763D TID:002516C0] CANNOT CALL
PROGRAM 'MY
SUB1'. ./MYMAIN: undefined symbol: MYSUB1 PGM=MYMAIN
Aborted

I am running on Red Hat Enterprise, and Fujitsu support say they will
only support:
* Red Hat Linux 7.2, Locale C
* Red Hat Linux 7.3, Locale C
* Red Hat Linux Advanced Server 2.1, Locale C

I am hoping that someone here has figured out how to compile and line
on less ancient versions of Linux.

---Charlie






From: Robert on
On Wed, 30 Jan 2008 15:00:14 -0800 (PST), charles.goodman(a)bell.ca wrote:

>I am evaluating Fujitsu NetCOBOL for Linux.
>I am having problems getting CALL/CANCEL to work.
>Here are two simple programs, first the main program then the called
>program:
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. MYMAIN.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 ACPT PIC X.
> PROCEDURE DIVISION.
> OPEN-PARA.
> DISPLAY "BEGIN MYMAIN".
> CALL 'MYSUB1'.
> DISPLAY "THE END - ACCEPTING ONE BYTE".
> ACCEPT ACPT.
> STOP RUN.
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. MYSUB1.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 ACPT PIC X.
> PROCEDURE DIVISION.
> OPEN-PARA.
> DISPLAY "BEGIN MYSUB1 - ACCEPTING ONE BYTE".
> ACCEPT ACPT.
> EXIT PROGRAM.
>
>The two source programs are saved as MYMAIN.CBL and MYSUB1.CBL.
>We want dynamic linkage since our real application consists of dozens
>of C programs and hundreds of COBOL programs.
>
>I tried compiling with:
>cobol -M -dy -WC,"BINARY(BYTE),DLOAD" -o MYMAIN MYMAIN.CBL
>cobol -dy -shared -WC,"BINARY(BYTE)" -o libMYSUB1.so MYSUB1.CBL
>
>when I try to execute I see my first DISPLAY and then it crashes:
>BEGIN MYMAIN
>cobol-rts:: HALT: JMP0015I-U [PID:0000763D TID:002516C0] CANNOT CALL
>PROGRAM 'MY
>SUB1'. ./MYMAIN: undefined symbol: MYSUB1 PGM=MYMAIN
>Aborted
>
>I am running on Red Hat Enterprise, and Fujitsu support say they will
>only support:
> * Red Hat Linux 7.2, Locale C
> * Red Hat Linux 7.3, Locale C
> * Red Hat Linux Advanced Server 2.1, Locale C
>
>I am hoping that someone here has figured out how to compile and line
>on less ancient versions of Linux.

Try '-l MYSUB1' (lower case el) on the compilation of MYMAIN. As written, MYMAIN has no
way of knowing the library name. Also, make sure your current directory is in
LD_LIBRARY_PATH, either as .: or explicitly.
From: Richard on
On Jan 31, 12:00 pm, charles.good...(a)bell.ca wrote:
> I am evaluating Fujitsu NetCOBOL for Linux.
> I am having problems getting CALL/CANCEL to work.
> Here are two simple programs, first the main program then the called
> program:
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. MYMAIN.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 ACPT PIC X.
> PROCEDURE DIVISION.
> OPEN-PARA.
> DISPLAY "BEGIN MYMAIN".
> CALL 'MYSUB1'.
> DISPLAY "THE END - ACCEPTING ONE BYTE".
> ACCEPT ACPT.
> STOP RUN.
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. MYSUB1.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 ACPT PIC X.
> PROCEDURE DIVISION.
> OPEN-PARA.
> DISPLAY "BEGIN MYSUB1 - ACCEPTING ONE BYTE".
> ACCEPT ACPT.
> EXIT PROGRAM.
>
> The two source programs are saved as MYMAIN.CBL and MYSUB1.CBL.
> We want dynamic linkage since our real application consists of dozens
> of C programs and hundreds of COBOL programs.
>
> I tried compiling with:
> cobol -M -dy -WC,"BINARY(BYTE),DLOAD" -o MYMAIN MYMAIN.CBL
> cobol -dy -shared -WC,"BINARY(BYTE)" -o libMYSUB1.so MYSUB1.CBL
>
> when I try to execute I see my first DISPLAY and then it crashes:
> BEGIN MYMAIN
> cobol-rts:: HALT: JMP0015I-U [PID:0000763D TID:002516C0] CANNOT CALL
> PROGRAM 'MY
> SUB1'. ./MYMAIN: undefined symbol: MYSUB1 PGM=MYMAIN
> Aborted

I tried that and it worked fine on my machine.

All it seems to need is the directory where the .so is located to be
on the LS_LIBRARY_PATH

Either add this to the LD_LIBRARY_PATH (eg:

LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
MYMAIN

or put the .so into one of the directories in that list.

> I am running on Red Hat Enterprise, and Fujitsu support say they will
> only support:
> * Red Hat Linux 7.2, Locale C
> * Red Hat Linux 7.3, Locale C
> * Red Hat Linux Advanced Server 2.1, Locale C
>
> I am hoping that someone here has figured out how to compile and line
> on less ancient versions of Linux.

I have no problem on Mandrake.

From: Richard on
On Jan 31, 4:38 pm, Robert <n...(a)e.mail> wrote:
> On Wed, 30 Jan 2008 15:00:14 -0800 (PST), charles.good...(a)bell.ca wrote:
> >I am evaluating Fujitsu NetCOBOL for Linux.
> >I am having problems getting CALL/CANCEL to work.
> >Here are two simple programs, first the main program then the called
> >program:
>
> > IDENTIFICATION DIVISION.
> > PROGRAM-ID. MYMAIN.
> > DATA DIVISION.
> > WORKING-STORAGE SECTION.
> > 01 ACPT PIC X.
> > PROCEDURE DIVISION.
> > OPEN-PARA.
> > DISPLAY "BEGIN MYMAIN".
> > CALL 'MYSUB1'.
> > DISPLAY "THE END - ACCEPTING ONE BYTE".
> > ACCEPT ACPT.
> > STOP RUN.
>
> > IDENTIFICATION DIVISION.
> > PROGRAM-ID. MYSUB1.
> > DATA DIVISION.
> > WORKING-STORAGE SECTION.
> > 01 ACPT PIC X.
> > PROCEDURE DIVISION.
> > OPEN-PARA.
> > DISPLAY "BEGIN MYSUB1 - ACCEPTING ONE BYTE".
> > ACCEPT ACPT.
> > EXIT PROGRAM.
>
> >The two source programs are saved as MYMAIN.CBL and MYSUB1.CBL.
> >We want dynamic linkage since our real application consists of dozens
> >of C programs and hundreds of COBOL programs.
>
> >I tried compiling with:
> >cobol -M -dy -WC,"BINARY(BYTE),DLOAD" -o MYMAIN MYMAIN.CBL
> >cobol -dy -shared -WC,"BINARY(BYTE)" -o libMYSUB1.so MYSUB1.CBL
>
> >when I try to execute I see my first DISPLAY and then it crashes:
> >BEGIN MYMAIN
> >cobol-rts:: HALT: JMP0015I-U [PID:0000763D TID:002516C0] CANNOT CALL
> >PROGRAM 'MY
> >SUB1'. ./MYMAIN: undefined symbol: MYSUB1 PGM=MYMAIN
> >Aborted
>
> >I am running on Red Hat Enterprise, and Fujitsu support say they will
> >only support:
> > * Red Hat Linux 7.2, Locale C
> > * Red Hat Linux 7.3, Locale C
> > * Red Hat Linux Advanced Server 2.1, Locale C
>
> >I am hoping that someone here has figured out how to compile and line
> >on less ancient versions of Linux.
>
> Try '-l MYSUB1' (lower case el) on the compilation of MYMAIN. As written, MYMAIN has no
> way of knowing the library name.

I think that you fail to understand what 'Dynamic Load' means.

> Also, make sure your current directory is in
> LD_LIBRARY_PATH, either as .: or explicitly.

Yes, it does need that.
From: Robert on
On Wed, 30 Jan 2008 20:46:28 -0800 (PST), Richard <riplin(a)azonic.co.nz> wrote:

>On Jan 31, 4:38 pm, Robert <n...(a)e.mail> wrote:

>> >when I try to execute I see my first DISPLAY and then it crashes:
>> >BEGIN MYMAIN
>> >cobol-rts:: HALT: JMP0015I-U [PID:0000763D TID:002516C0] CANNOT CALL
>> >PROGRAM 'MY
>> >SUB1'. ./MYMAIN: undefined symbol: MYSUB1 PGM=MYMAIN
>> >Aborted
>>
>> >I am running on Red Hat Enterprise, and Fujitsu support say they will
>> >only support:
>> > * Red Hat Linux 7.2, Locale C
>> > * Red Hat Linux 7.3, Locale C
>> > * Red Hat Linux Advanced Server 2.1, Locale C
>>
>> >I am hoping that someone here has figured out how to compile and line
>> >on less ancient versions of Linux.
>>
>> Try '-l MYSUB1' (lower case el) on the compilation of MYMAIN. As written, MYMAIN has no
>> way of knowing the library name.
>
>I think that you fail to understand what 'Dynamic Load' means.

There is no Cobol syntax to specify a library name. You can only specify an entry point
name. When you do a CALL, Unix doesn't search every library in the library path. That
would be hopelessly slow. It searches only the libraries named in the executable's ELF
header.

Libraries normally contain many programs and entry points. They are not one-for-one like
the example here.