0

I want to specify a single byte area in linkage section. Program A could call program B as

call 'PROGB'   using mycopybook

where mycopybook could be 500 bytes one time, 2000 bytes the next time etc etc.

A "simple" way around avoiding the need to know/reserve the maximum number of bytes expected in the linkage section in program B is to define it as ONE byte (after all, program B's linkage section is only a pointer to mycopybook in memory, neither more nor less). Trouble is, when I try and compile program B using the following

LINKAGE SECTION.
01  copybook-1     pic x.
procedure division using copybook-1.
display 'First 4 bytes passed in 'copybook-1(1:4)

I get a compilation error.

progent.cbl: 113: error: length of 'copybook-1' out of bounds: 4

Is there some COBC parameter that is the equivalent of NOSSRANGE?

(FWIW, In Micro Focus' Mainframe Express, the default where I worked was SSRANGE, so I had to set NOSSRANGE specifically for the example above, but after that there was no problem)

1 Answers1

0

Is there some COBC parameter that is the equivalent of NOSSRANGE?

Answer: no, not currently. You may create a feature-request or even provide a patch for not checking the bounds at compile time.

GnuCOBOL does have an option to enable all runtime checks: --debug, using this would be similar to SSRANGE(2) [check on compile and run-time], but not using it is not similar to NOSSRANGE as the compile-time checks are done unconditional; you can only disable compile-time constant folding like field (1-1:5) by -fno-constant-folding which will then not raise an issue but field (0:5) will always do so.

If you are fine to have it disabled in general you can of course adjust the compiler (cobc/typeck.c) and remove those checks but a switch would be much better!

Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38