rspec/rules/S2794/rpg/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

51 lines
1.3 KiB
Plaintext

== Why is this an issue?
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
[source,rpg]
----
F MyFile IF E Disk
* Noncompliant
C READ Record1
----
=== Compliant solution
[source,rpg]
----
F MyFile IF E Disk
D InputData DS LikeRec(Record1)
C READ Record1 InputData
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use a result data structure for this file I/O.
'''
== Comments And Links
(visible only on this page)
=== on 2 Apr 2015, 17:42:59 Ann Campbell wrote:
http://www.bmeyers.net/faqs/14-tips/32-rpg-iv-style?start=3
http://www.ibmsystemsmag.com/ibmi/developer/rpg/Ending-Those-Decimal-Data-Error-Blues/?page=1
endif::env-github,rspecator-view[]