Default: | On |
Type: | General |
working-storage section. 01 item-a pic 9.
procedure division. If item-a = 0. Display "zero" else display "nonzero" end-if.
The variable item-a is not initialized by a VALUE clause, and so contains a space character x"20". Running this program with the F switch set on causes the run-time system to check whether the numeric field contains a non-numeric value resulting in run-time error 163.
Comments:
If the data is not valid, run-time system error 163 ("Illegal character in numeric field") is produced. Setting this switch to off suppresses this checking.
This checking is only done on generated code created with the CHECKNUM Compiler directive, and on intermediate code.
The run-time system and generated code try to optimize many types of numeric operations. These operations can cause invalid results if the numeric operands do not contain valid numeric data. By default, the run-time system gives the run-time system error 163 when a numeric operation is tried with invalid numeric data.
Invalid data is handled differently by intermediate and native code. We recommend that you enable numeric field checking while you are developing your program.
If you receive run-time error 163, we recommend that you adjust your code so that no invalid data is used. You can locate the invalid numeric data in your code by setting the +F switch on and then animating your program until run-time system error 163 is detected.
If you are not able to correct your code, you might want to use one or more of the following Compiler directives to resolve invalid data in numeric fields: