rspec/rules/S1634/rpg/rule.adoc

51 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
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)++``.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
FDDDLJNL7 UF E K DISK INFSR(*PSSR)
...
C READ DDDLJNL7
----
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
FDDDLJNL7 UF E K DISK INFSR(*PSSR)
...
/free
read DDDLJNL7;
/end-free
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
FDDDLJNL7 UF E K DISK INFSR(*PSSR)
...
C READ(N) DDDLJNL7
----
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
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)
include::message.adoc[]
endif::env-github,rspecator-view[]