v60NumWithCharBehavior

The v60NumWithCharBehavior build descriptor option affects how EGL handles the NUM type in assignments and comparisons.

Starting with version 7, EGL treats the NUM type in the same way it treats other numeric types in assignments or comparisons to CHAR values.

If the v60NumWithCharBehavior build descriptor option is set to YES, EGL treats NUM type variables the way it did in earlier versions and in VisualAge® Generator. The differences in behavior are subtle and complex; you should set this option to YES only if you need to emulate VisualAge Generator. For more information, see the examples in this topic.

VisualAge Generator and version 6.0 have different behaviors on generated COBOL programs when moving and assigning data. VisualAge Generator did not alter the sign of the numeric value before it was moved or assigned, whereas version 6.0 did. In other words, VisualAge Generator did a byte move with no modification whereas version 6.0 does a byte move but only after it has set the sign to be a displayable NUM value. In most cases this difference will not be noticed but can affect moves when the NUM field contains a byte whose high order nibble contains a hex C (x'Cx'). Therefore, if the desired result is to completely emulate the behavior of VisualAge Generator, then the additional symbolic parameter VAGNUMWITHCHARBEHAVIOR must also be set to a value of YES.

The v60NumWithCharBehavior option can affect the behavior of other build descriptor options such as spacesZero and blanksAsZero. For more information, see spacesZero and blanksAsZero.

Values

NO
EGL should treat the NUM type as it does all other numeric types.
YES
EGL should treat the NUM type as it did in VisualAge Generator.

Default value

The default value of v60NumWithCharBehavior depends on the vagCompatibility build descriptor option:
  • If vagCompatibility is set to YES, the default value for v60NumWithCharBehavior is YES.
  • If vagCompatibility is set to NO, the default value for v60NumWithCharBehavior is NO.

Manually setting the option

In most cases, you should not need to manually set the v60NumWithCharBehavior build descriptor option.

Examples

If v60NumWithCharBehavior is set to YES, you can make the following comparison:
if( "2009-03-26" > 0)
  ...
end

The 0 is converted to "0" for the comparison. In version 7 behavior, 0 is a number and the comparison fails because "2009-03-26" is an invalid number.

If v60NumWithCharBehavior is set to YES, EGL assigns a NUM to a CHAR using a byte move.
num_var NUM = -4;
char_var CHAR(1);

char_var = num_var; // value of char_var is 't'
The value of char_var will be:
  • + 't' (x'74') in the debugger and Java Generation
  • + 'M' (x'D4') in generated COBOL
These values reflect the difference in how negative numbers are represented in ASCII and EBCDIC.

In version 7 behavior, char_var would have a value of -4.


Feedback