rspec/rules/S1619/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

55 lines
1.5 KiB
Plaintext

== Why is this an issue?
The storage of a packed numeric field is most efficient when you code an odd number of digits in the PICTURE description, so that the leftmost byte is fully used. Packed-decimal items are handled as fixed-point numbers for arithmetic purposes.
=== Noncompliant code example
[source,cobol]
----
01 VAL PIC 9(6) COMP-3.
----
=== Compliant solution
[source,cobol]
----
01 VAL PIC 9(5) COMP-3.
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Change this field definition to be odd-length.
'''
== Comments And Links
(visible only on this page)
=== on 4 Dec 2018, 21:11:56 Sam Fox wrote:
This rule seems to be incorrectly flagging the following:
----
10 BENE-GROSS-WK-AMT PIC S9(9)V9(2) COMP-3
OCCURS 010 TIMES.
----
We believe this is due to "OCCURS 10 TIMES" which might inadvertently tripping the even check.
=== on 4 Dec 2018, 21:21:28 Ann Campbell wrote:
\[~SMFox] thanks for your report of this false positive and kudos on identifying the related ticket! However, this should really be reported in the https://community.sonarsource.com[SonarSource Community]. Would you mind opening a thread there, please?
=== on 4 Dec 2018, 21:31:40 Sam Fox wrote:
Created \https://community.sonarsource.com/t/cobol-packed-numeric-fields-should-be-defined-with-odd-length-false-positive/4856
Thanks [~ann.campbell.2]!
endif::env-github,rspecator-view[]