ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Build a program with the exception of unused code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Build a program with the exception of unused code

    Hello to all. Tell me, is it possible to configure the CRTPGM command so that there is no unused code in the resulting program? For example, a program consists of 2 modules, one of which has a procedure that is not called anywhere in this particular program. Is it possible to create a program from these modules so that the code for this procedure (and, accordingly, the procedure itself) is absent in the finished program?

  • #2
    No, I don't think so. Not unless the compiler automatically ignores unreachable code (which wouldn't surprise me - it's not an uncommon compiler optimisation).
    There is Ctl-Opt (H-spec) keyword OPTION(*NOUNREF) that prevents unused variable definitions from being compiled (with some exceptions). But that only applies to variables, not procedures

    Comment


    • #3
      Vectorspace, thanks for the info on the *NOUNREF option. I will try to use it to eliminate information messages RNF7031.
      However, I would like to hope that you are wrong about the impossibility of excluding unused code from the compiled program. After all, there is an IPA parameter in the CRTPGM command. What is it for?

      Comment


      • #4
        *NOUNREF will not stop RNF7031 from being included in the compile listing.
        The benefit of *NOUNREF is that unused variables will not be included in the compiled module/program, and therefore not use up memory at runtime.
        RNF7031 is a warning generated by the compiler that you have unreferenced fields. You can hide them (if you use RDi for your compiles) by setting the error panel to hide Severity 10 messages, but the compiler will still generate RNF7031 in the compile listing and EVFEVENT file.
        I'm not familiar with IPA

        Comment

        Working...
        X