rspec/rules/S3767/cobol/rule.adoc

38 lines
1.2 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
``++CAST(... AS CHAR/VARCHAR)++`` can be a source of incompatibilities between database versions: the behavior of ``++CAST++`` may not be the same depending on the version of the database system. Such incompatibilities can cause unexpected output from applications that ``++CAST++`` decimal data to ``++CHAR++`` or ``++VARCHAR++``, it's therefore best to avoid using ``++CAST(... AS CHAR/VARCHAR)++``.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cobol]
2021-04-28 16:49:39 +02:00
----
DELETE product
WHERE CAST(status_code AS CHAR(2)) = '42' -- Noncompliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Avoid using 'CAST(... AS CHAR/VARCHAR)'
'''
== Comments And Links
(visible only on this page)
=== on 25 Oct 2016, 11:36:16 Nicolas Bontoux wrote:
+References+:
* http://www.ibm.com/support/knowledgecenter/SSEPEK_11.0.0/sqlref/src/tpc/db2z_castspecification.html[CAST specification]
* http://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/apsg/src/tpc/db2z_relincompatapplsqlfromv9.html[IBM note on SQL release incompatibilities] (see section _Changes to string formatting of decimal data_)
endif::env-github,rspecator-view[]