
NUMCHECK
The NUMCHECK
compiler option tells the
compiler whether to generate extra code to validate data items when
they are used as sending data items. For zoned decimal (numeric USAGE
DISPLAY
) and packed decimal (COMP-3
) data
items, the compiler generates implicit numeric class tests for each
sending field. For binary data items, the compiler generates SIZE
ERROR
checking to see whether the data item has more digits
than its PICTURE
clause allows.
The
NUMCHECK
option was changed to
improve performance by removing redundant checks, with PTF for APAR
PH08642 installed. There may be fewer runtime messages after applying
this APAR than before.
The analysis done to remove redundant checks is more
involved at
OPT(1|2)
than at OPT(0)
. OPT(0)
does
a simpler form of the analysis to keep compilation time as low as
possible. There may be fewer messages at higher OPT
levels.
When the compiler is able to determine at compile
time that a check will always find invalid data, a compile time
message is produced, and the check may be removed. (See
MSG|ABD
below.)
- Default
NUMCHECK=(NO)
Suboption defaults are:
- If no suboption is specified, defaults are
NUMCHECK=(ZON(ALPHNUM),PAC,BIN,MSG)
. - If no datatype suboption is specified, default datatype suboptions
are
ZON(ALPHNUM)
,PAC
, andBIN
. For example,NUMCHECK=(ABD)
has the same effect as
.NUMCHECK=(ZON(ALPHNUM),PAC,BIN,ABD)
- If only one datatype suboption is specified, defaults are
NOZON
,NOPAC
,NOBIN
, andMSG
. For example,NUMCHECK=(BIN)
has the same effect asNUMCHECK=(NOZON,NOPAC,BIN,MSG)
. - If all datatype suboptions are specified with
NO
, then the listing will showNONUMCHECK
. For example,NUMCHECK=(NOZON,NOPAC,NOBIN)
has the same effect asNUMCHECK=NO
.
- If no suboption is specified, defaults are
ZON [(ALPHNUM | NOALPHNUM)] | NOZON
Specifying
ZON
orZON(ALPHNUM)
causes the compiler to generate code for an implicit numeric class test for zoned decimal (numericUSAGE DISPLAY
) data items that are used as sending data items in COBOL statements.PAC | NOPAC
Specifying
PAC
causes the compiler to generate code for an implicit numeric class test for packed decimal (COMP-3
) data items that are used as sending data items in COBOL statements.For packed decimal data items that have an even number of digits, the unused bits are checked for ones.
Restriction:For
CALL
statements,NUMCHECK=(ZON)
andNUMCHECK=(PAC)
checkBY CONTENT
data items that are zoned decimal or packed decimal, but they do not checkBY REFERENCE
parameters. (Neither zoned decimal nor packed decimal data items can be specified in aBY VALUE
phrase.)BIN | NOBIN
- Specifying
BIN
causes the compiler to generate code similar toON SIZE ERROR
to test if binary data items contents are bigger than thePICTURE
clause. This extra code will be generated only for binary data items that are used as sending data items, andCOMP-5
data items will not get thisON SIZE ERROR
code generated. MSG | ABD
- Determines whether the message issued for invalid data is a warning
level message to continue processing or a terminating level message
to cause an abend:
- If
MSG
is in effect, a runtime warning message with the line number, data item name, data item content, and program name is issued. - If
ABD
is in effect, a terminating message is issued that causes an abend.
When the compiler is able to determine at compile time that a check will always find invalid data, a compile time message is produced:
- If
MSG
is in effect, the message is a warning-level message and the check is still done at runtime. - If
ABD
is in effect, the message is an error-level message and the check is removed.
- If
NO
No code is generated to validate data items when they are used as sending data items.
Performance considerations: NUMCHECK
is
much slower than NUMCHECK=NO
, depending on how many
zoned decimal (numeric USAGE DISPLAY) data items, packed decimal (COMP-3)
data items, and binary data items are used in a COBOL program.With PTF for APAR PH08642 installed, performance of
NUMCHECK
has
been improved. However, performance is still best when specifying NONUMCHECK
,
and will be better at a higher OPT
level.
ZONECHECK
is
deprecated and can no longer be specified in IGYCDOPT. NUMCHECK=(ZON(ALPHNUM))
gives
the same results as ZONECHECK
used to.
