GZJ 1100006WMT Visits (1493)
DB2 10 introduces implicit casting between numeric and string data types, making it possible for you to (for example) use SELECT COUNT(*) with a COBOL PIC X field as the target host variable. Of course, this feature is not available until New Function Mode, to ensure that you can fall back to DB2 8 or DB2 9 from DB2 10 CM8 or CM9. At some point, most IT shops will be doing development work in DB2 10 NFM, while production is still running DB2 10 Conversion Mode. To protect against new function being promoted into production, the ZPARM NEWFUN is available. This can (and should) be set to NEWFUN(V8) or NEWFUN(V9), as appropriate.
So far, so good. But ... there is a 'gotcha'. NEWFUN only affects the precompiler and coprocessor - that is, it checks for syntax that is incompatible with V8 or V9. It doesn't have any effect at run time. The data type clash between the numeric COUNT(*) and the string data type of COBOL PIC X is not a syntax error. In fact, this is classified as a semantic error. And when are semantic errors detected? At run-time, of course.
The net effect of this is that your COBOL program, being developed and tested at DB2 10 NFM, will precompile, compile, bind and execute successfully (remember, NEWFUN only affects the precompiler and coprocessor). However, when the program is promoted to production, which as at DB2 10 CM8 or CM9, at run-time the application will fail with SQL Code -303.
Unless you have a pre-production system running at the same mode as production, you can't detect this problem without falling back your test system to Conversion Mode to test your applications prior to promoting them to production.
At the moment there is no permanent solution for this, so this is something you have to watch out for and plan for.