rspec/rules/S3573/cobol/rule.adoc

59 lines
1.7 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Because statically-called programs must be relinked before they reflect changes in the code, it makes sense to prefer dynamic calls instead. Further, since statically-called programs are included in the caller's load module, those modules could require more main storage than if the calls were dynamic, and the called programs could reside in memory multiple times - one for each caller.
While static calls are faster, their other disadvantages make dynamic calls the preferred method. Thus, this rule raises an issue when the program to ``++CALL++`` is hard-coded, rather than specified in a variable.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cobol]
2021-04-28 16:49:39 +02:00
----
CALL 'MYPRGM01' USING PARAM1. *> Noncompliant
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cobol]
2021-04-28 16:49:39 +02:00
----
77 PRGM-NAME PIC X(8) VALUE 'MYPRGM01'.
[...]
CALL PRGM-NAME USING PARAM1.
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use a variable to specify the program to "CALL".
=== Highlighting
``++CALL 'xxxx'++``
'''
== Comments And Links
(visible only on this page)
=== on 22 Mar 2016, 09:15:31 Pierre-Yves Nicolas wrote:
I think the title should not mention "arguments". The rule is only about the program which is called, not the arguments (defined in the ``++USING++`` clause).
See the http://www.ibm.com/support/knowledgecenter/SS6SG3_5.1.0/com.ibm.entcobol.doc_5.1/PGandLR/ref/rlpscall.html[IBM reference for CALL].
=== on 22 Mar 2016, 13:41:03 Ann Campbell wrote:
How's this [~pierre-yves.nicolas]?
=== on 22 Mar 2016, 13:49:02 Pierre-Yves Nicolas wrote:
Looks good [~ann.campbell.2].
endif::env-github,rspecator-view[]