A preprocessor error directive causes the preprocessor to generate an error message and causes the compilation to fail.
The error directive has the form:
.-----------. V | >>-#--error----character-+-------------------------------------><
Use the error directive as a safety check during compilation. For example, if your program uses preprocessor conditional compilation directives, put error directives in the source file to prevent code generation if a section of the program is reached that should be bypassed.
For example, the directive
#error Error in TESTPGM1 - This section should not be compiled
generates the following error message:
Error in TESTPGM1 - This section should not be compiled
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.