Re: compile+link Fujitsu Linux
- From: Richard <riplin@xxxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 11:14:26 -0800 (PST)
On Feb 1, 6:48 am, charles.good...@xxxxxxx wrote:
Thanks for the tips.
Yes I needed to add my curent directory to LD_LIBRARY_PATH
I also nneded to add "-L./" to the cobol command to compile the main
program.
My compile commands, that work are:
cobol -dy -shared -WC,"BINARY(BYTE)" -o libMYSUB1.so MYSUB1.cbl
cobol -dy -shared -WC,"BINARY(BYTE)" -o libMYSUB2.so MYSUB2.cbl
cobol -M -dy -WC,"BINARY(BYTE),DLOAD" -o MYMAIN -L./ -lMYSUB1 -lMYSUB2
MYMAIN.cbl
I am able to compile and execute. My simple programs are designed to
allow me to see the functioning of CALL and CANCEL.....
However the results is NOT exactly what I want. Using -l does not
allow for proper functioning of the CANCEL verb (see pg 77 of user's
guide). Once a subprogram is loaded with a CALL statement, it remains
in memory regardless of CANCEL statements. The working-storage of the
sub-program is not reinitialized upon a second CALL.
Robert is completely wrong. You do not need a -l or a -L. These will
turn the CALLs into a static load and, as you say, the CANCEL will not
work as expected.
Go back to using your original compiles and links _without_ the -l or -
L.
It was only the LD_LIBRARY_PATH change that was required.
I am not sure how you determined that the CANCEL did not work but I
modified your programs to add a 2nd CALL and a CANCEL followed by a
3nd CALL in MYMAIN and then added a check for 'first time in' into
MYSUB1 and it worked as _I_ expected.
IDENTIFICATION DIVISION.
PROGRAM-ID. MYMAIN.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ACPT PIC X.
PROCEDURE DIVISION.
OPEN-PARA.
DISPLAY "BEGIN MYMAIN".
CALL 'MYSUB1'.
CALL 'MYSUB1'.
CANCEL 'MYSUB1'.
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.
01 FIRST-IN PIC X VALUE "Y".
PROCEDURE DIVISION.
OPEN-PARA.
IF FIRST-IN = "Y"
DISPLAY "First Time In"
ELSE
DISPLAY "Been here before"
END-IF
MOVE "N" TO FIRST-IN
DISPLAY "BEGIN MYSUB1 - ACCEPTING ONE BYTE".
ACCEPT ACPT.
EXIT PROGRAM.
As expected I got (ignoring your displays and accepts):
First Time In
Been here before
First Time In
So the CANCEL worked exactly as it should.
.
- References:
- compile+link Fujitsu Linux
- From: charles . goodman
- Re: compile+link Fujitsu Linux
- From: charles . goodman
- compile+link Fujitsu Linux
- Prev by Date: Re: help with tables
- Next by Date: Re: compile+link Fujitsu Linux
- Previous by thread: Re: compile+link Fujitsu Linux
- Next by thread: db2 prep and nested exec sql
- Index(es):
Relevant Pages
|