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

56 lines
1.3 KiB
Plaintext

== Why is this an issue?
When accessing a non-input-only file with a ``++CHAIN++``/``++READx++`` operation, the record is locked and becomes inaccessible to the system, and unreadable other programs. This is fine if you are about to update the record immediately, but if you have data processing to do following the read, it can leave the record unavailable for too long. Therefore, non-input files using the ``++CHAIN++``, ``++READ++``, ``++READE++``, ``++READP++``, and ``++READPE++`` operation codes should always be accessed with the no lock option, ``++(N)++``.
=== Noncompliant code example
[source,rpg]
----
FDDDLJNL7 UF E K DISK INFSR(*PSSR)
...
C READ DDDLJNL7
----
[source,rpg]
----
FDDDLJNL7 UF E K DISK INFSR(*PSSR)
...
/free
read DDDLJNL7;
/end-free
----
=== Compliant solution
[source,rpg]
----
FDDDLJNL7 UF E K DISK INFSR(*PSSR)
...
C READ(N) DDDLJNL7
----
[source,rpg]
----
FDDDLJNL7 UF E K DISK INFSR(*PSSR)
...
/free
read(n) DDDLJNL7;
/end-free
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Add the "N" option to this file access.
endif::env-github,rspecator-view[]