Rule Definition
Parts of data can be accessed by using their position and their length in a data group. This mechanism is error prone for two points: the developer can introduce errors in defining the position of the part of data to access.
In addition, this position is dependent of any changes in the data before placed before it.
Thus, problems can easily occur in production and data may be corrupted.
Remediation
Data which need to be accessed partially must have detailed fields. Then, look for accesses using position and length and replace them by fields accesses.
Violation Code Sample
01 WSS-RUB PIC X(10).
01 WSS-VAL PIC X(20).
01 WSS-ENTITY PIC X(8).
...
IF WSS-RUB(1:3) = 'BAK'
MOVE WSS-VAL (1:8) TO WSS-ENTITE
END-IF
Fixed Code Sample
01 WSS-RUB.
05 WSS-RUB-ID PIC X(3).
05 FILLER PIC X(7).
01 WSS-VAL.
05 WSS-VAL-ENTITY PIC X(8).
05 WSS-OTHER-DATA PIC X(12).
01 WSS-ENTITY PIC X(8).
...
IF WSS-RUB-ID = 'BAK'
MOVE WSS-VAL-ENTITY TO WSS-ENTITE
END-IF
Related Technologies
Cobol
Technical Criterion
Complexity - Algorithmic and Control Structure Complexity
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.