ZONECHECK

Start of changeUse the ZONECHECK option to have the compiler generate IF NUMERIC class tests for zoned decimal data items that are used as sending data items. End of change

Note: Start of changeIn Enterprise COBOL V6.1 with PTF for APAR PI71625 installed, ZONECHECK is deprecated but is tolerated for compatibility, and it is replaced by Start of changeNUMCHECK(ZON(ALPHNUM))End of change. End of change

ZONECHECK option syntax

Read syntax diagramSkip visual syntax diagramNOZONECHECKZONECHECK(MSGABD)

Default is: NOZONECHECK

Abbreviations are: NOZC|ZC(MSG)|ZC(ABD)

MSG

The MSG suboption requests that an IF NUMERIC test be done on every use of zoned decimal data items as senders, and if the data is invalid (for example, NOT NUMERIC), a runtime warning message Start of changewith the line number, data item name, data item content, and program name is issuedEnd of change. Start of changeAlso, the affected statements will still be executed. End of changeStart of changeZONECHECK(MSG) is treated as if NUMCHECK(ZON,MSG) were in effect.End of change

ABD

The ABD suboption requests that an IF NUMERIC test be done on every use of zoned decimal data items as senders, and if the data is invalid (for example, NOT NUMERIC), a terminating message is issued that causes an abend. Start of changeZONECHECK(ABD) is treated as if NUMCHECK(ZON,ABD) were in effect.End of change

Both ZONECHECK(MSG) and ZONECHECK(ABD) result in the compiler generating an implicit numeric class test for each zoned decimal data item that is referenced as a sender in a COBOL statement. 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 item is used in each statement:
  • If the data item is NOT NUMERIC, either a warning message for ZONECHECK(MSG) or a terminating message for ZONECHECK(ABD) is issued.
  • If the data item is NUMERIC, the external behavior of the statement is the same as NOZONECHECK, other than being slower.
Restriction: Start of changeFor CALL statements, ZONECHECK checks BY CONTENT and BY VALUE data items that are numeric USAGE DISPLAY only, but it does not check BY REFERENCE parameters.End of change

Performance considerations: ZONECHECK(MSG) and ZONECHECK(ABD) are much slower than NOZONECHECK, depending on how many zoned decimal data items are used in COBOL statements in a program.

related references  
Start of changeNUMCHECKEnd of change  
NUMPROC  
ZONEDATA