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.

Syntax

Read syntax diagramSkip visual syntax diagramNUMCHECK=*( NO,ZON(ALPHNUMNOALPHNUM)NOZONPACNOPACBINNOBINMSGABD )
Default
NUMCHECK=(NO)
Start of changeSuboption 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, and BIN. For example, NUMCHECK=(ABD) has the same effect as Start of changeNUMCHECK=(ZON(ALPHNUM),PAC,BIN,ABD)End of change.
  • If only one datatype suboption is specified, defaults are NOZON, NOPAC, NOBIN, and MSG. For example, NUMCHECK=(BIN) has the same effect as NUMCHECK=(NOZON,NOPAC,BIN,MSG).
  • If all datatype suboptions are specified with NO, then the listing will show NONUMCHECK. For example, NUMCHECK=(NOZON,NOPAC,NOBIN) has the same effect as NUMCHECK=NO.
End of change
Start of changeZON [(ALPHNUM | NOALPHNUM)] | NOZONEnd of change
Start of changeSpecifying ZON or ZON(ALPHNUM) causes the compiler to generate code for an implicit numeric class test for zoned decimal (numeric USAGE DISPLAY) data items that are used as sending data items in COBOL statements. End of change
Start of changeSpecifying ZON(NOALPHNUM) causes the compiler to generate code for an implicit numeric class test for zoned decimal (numeric USAGE DISPLAY) data items that are used as sending data items in COBOL statements, except when they are used in a comparison with an alphanumeric data item, alphanumeric literal or alphanumeric figurative constant.End of change
Receivers are not checked, unless they are both a sender and a receiver, such as data item B in the following sample statements:
ADD A TO B
DIVIDE A INTO B
COMPUTE B = A + B
INITIALIZE B REPLACING ALPHANUMERIC BY B
This checking is done before the data is used in each statement:
  • If the data is NOT NUMERIC, either a warning message for NUMCHECK=(ZON,MSG) or a terminating message for NUMCHECK=(ZON,ABD) is issued.
  • If the data is NUMERIC, the external behavior of the statement is the same as NUMCHECK=(NOZON), other than being slower.
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. Start of changeFor packed decimal data items that have an even number of digits, the unused bits are checked for ones.End of change

Restriction: Start of changeFor CALL statements, NUMCHECK=(ZON) and NUMCHECK=(PAC) check BY CONTENT data items that are zoned decimal or packed decimal, but they do not check BY REFERENCE parameters. (Neither zoned decimal nor packed decimal data items can be specified in a BY VALUE phrase.)End of change
BIN | NOBIN
Specifying BIN causes the compiler to generate code similar to ON SIZE ERROR to test if binary data items contents are bigger than the PICTURE clause. This extra code will be generated only for binary data items that are used as sending data items, and COMP-5 data items will not get this ON 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. Start of changeAlso, the affected statements will still be executed. End of change
  • If ABD is in effect, a terminating message is issued that causes an abend.
Start of changeNOEnd of change
Start of changeNo code is generated to validate data items when they are used as sending data items. End of change

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.

In Enterprise COBOL V6.1 with PTF for APAR PI71625 installed, ZONECHECK is deprecated and can no longer be specified in IGYCDOPT. NUMCHECK=(ZON(ALPHNUM)) gives the same results as ZONECHECK used to.

related references  
NUMPROC  
TRUNC  
ZONECHECK  
ZONEDATA