Skip to main content

Hi.  There is a compiler option, -Wr, which turns off the normal warning we get if the redefiner is bigger than the data being redefined.  I remember seeing an option that could be turned on to do the opposite - warn if the redefiner is smaller, but I'm wondering if that was an rm/cobol option because I cannot find it in my 10.2.1 documentation.  Alternatively, a way to reorganize my copy library to use the standard warning would be a great option, but I don' t think I can:

Issue: I have a table of standard data, sitting in a copy library, as a level 01 table with a sequence of 03 level fillers with value.  That's the table data.  Then I redefine it, using an occurs, to have access to the data.   The table of standard data is constantly growing.  But we often forget to increase the size of the constant for the occurs.  How do I avoid making the mistake of adding data without updating the size of the occurs?

I cannot switch them around, because the redefiner cannot have value clauses.  The programs that use this table need to know how many entries are in it.

Rambling thought: I just thought of a solution I don't like - change the programs using this copy library to compute the array size using the LENGTH OF command and a constant with the record size, and doing the math.  Would have to change the occurs size to be much larger than the data, so that won't get an array access error.  But that raises the spectre of accessing working storage memory via the array if the computation is ever wrong, say the addition to the table used wrong record size in the picture.  unlikely but possible.  Much better if the compiler can spot the error.

 

P.S. is there any way to turn compiler directives on/off in the middle of the source code?  The conditional compilation does not seem to allow that.


#REDEFINES
#COMPILER