Michael Simpson
Michael Simpson

Reputation: 37

Cobol program A calls program B via an entry point in B and crashes

COBOL program B has 3 entry points. Linkage section contains 1 general area, and then 3 areas (call them link-sect-a, link-sect-b and link-sect-c) Cobol program A calls program B using entry 3. In z/OS, it's perfectly valid (and normal) to write

CALL PROGB-ENTRY3 using common area, link-sect-c

The trouble seems to be with GnuCobol, that after compiling both, anything as simple as the following in program B after entry point 3

DISPLAY 'First 50 bytes in link-sect-c 'link-sect-c(1:50)

causes a crash on the reference to link-sect-c

If instead, I change the call in program A (as well as the entry 3 in program B to include all 4 arguments) to

CALL PROGB-ENTRY3 using common area, link-sect-a, link-sect-b, link-sect-c

(even though I have no need for either link-sect-a or link-sect-b) the code works

I can include the 2 example programs if required, since they're really quite trivial

Upvotes: 0

Views: 377

Answers (1)

Michael Simpson
Michael Simpson

Reputation: 37

I added the option -fsticky-linkage to the compilation of program B, and that solved the problem. (It was easy to confirm it. Remove the option and compile again; problem reintroduced)

Upvotes: 0

Related Questions