We are scanning Cobol sources.
When we move an alphanumeric field to a numeric field WITH CONVERSION we get a
(false) positive on rule cobol:S1966:
… is a numeric field; … cannot be safely moved into it.
However, as long as you move WITH CONVERSION, there should not be a problem.
Versions used:
Cobol: AcuCobol version 10.2.1, fixed format
SonarQube: Enterprise Edition Version 10.2.1 (build 78527)
Source code example:
…
IDENTIFICATION DIVISION.
PROGRAM-ID. PP0046.
WORKING-STORAGE SECTION.
01 NUMERIC-VALUE PIC 9(02).
01 ALPHA-VALUE PIC X(02) VALUE “03”.
PROCEDURE DIVISION.
MAIN SECTION.
MOVE ALPHA-VALUE TO NUMERIC-VALUE WITH CONVERSION
GOBACK
.
…
We would appreciate a change in the check, so that this is no longer a remark.