0

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

  • Full programs are not needed but the `ENTRY` statements are. Useful would also be the full compilation command (`cobc` ...) and the version number of GnuCOBOL you use. – Simon Sobisch Jul 02 '19 at 21:52

1 Answers1

0

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)

  • I suggest to now accept your own answer :-) and yes, `-fsticky-linkage` is necessary for this ibm behavior to include (or ´-std=ibm[-strict]` which include a bunch of options). I generally don't suggest to use those dialect options for every program but you may want to compare ibm-strict.conf and default.conf to check if there are other options you may want to take over). – Simon Sobisch Jul 03 '19 at 17:54
  • Sorry, according to your link, I'm supposed to see some text "Answer your own question" or some checkbox somewhere, but I don't. I tried editing my answer again to see if it turned up there but not as far as I could see. – Michael Simpson Jul 04 '19 at 11:28
  • Yes, [you should see a checkbox below your answer](https://stackoverflow.blog/2009/01/06/accept-your-own-answers/) - after 48hours which are not over yet – Simon Sobisch Jul 04 '19 at 12:23
  • Aha, you forgot to mention the 48 hours in your earlier append – Michael Simpson Jul 05 '19 at 05:19
  • Not sure. Do I edit the answer I added and then I should see the checkbox ('cos I didn't). At the same time, it now seems to be answered on jul 3, 8.56 ???? – Michael Simpson Jul 09 '19 at 12:31
  • No, you should see the checkbox directly, as documented in the link above (maybe force site reload with [CTRL]+[F5]?) – Simon Sobisch Jul 09 '19 at 18:30