rspec/rules/S2794/rpg/rule.adoc
2021-04-28 18:08:03 +02:00

25 lines
782 B
Plaintext

The use of a result data structure with file I/O improves performance because it moves the data in one large block from file to data structure (or vice versa) rather than field by field.
Additionally using a data structure can limit the problems caused by having bad data in a file. Without a data structure, the entire ``++READ++`` operation will fail at the first bad value. With one, the error comes only when the bad field is used.
== Noncompliant Code Example
----
F MyFile IF E Disk
* Noncompliant
C READ Record1
----
== Compliant Solution
----
F MyFile IF E Disk
D InputData DS LikeRec(Record1)
C READ Record1 InputData
----