rspec/rules/S3767/cobol/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

38 lines
1.2 KiB
Plaintext

== Why is this an issue?
``++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
[source,cobol]
----
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[]