ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Open-Access incompatible with On-Exit

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

  • Open-Access incompatible with On-Exit

    I'm getting this compiler error:
    RNF0203 OPEN-ACCESS FILE {my_file_here} CANNOT BE DEFINED IN A PROCEDURE WITH AN ON-EXIT SECTION.

    Any idea what's up with that? Is that just a temporary restriction? FWIW, I'm on 7.3 with PTFs current as-of 01 Jul 2019.

    TIA

  • #2
    From the manual:

    Restrictions for the ON-EXIT section:
    The following are not allowed in a procedure with an ON-EXIT section:
    Local SPECIAL files.
    Local open access files.
    *PSSR subroutines. Use a MONITOR group instead.
    Multiple occurrence data structures. Use a data structure array instead.
    Tables. Use an array instead.
    ON-EXIT is not allowed in a Java native method. Move the logic for the native method into another procedure that is called by the native method.
    ON-EXIT is not allowed in a cycle-main procedure. Move the logic for the cycle-main procedure into another procedure that is called by the cycle-main procedure, or change your module to use a linear-main procedure.
    The following are not allowed in the ON-EXIT section:
    Calls to the APIs CEEDOD, CEEGSI, and CEETSTA. Call these procedures in the main body of the procedure and save the results in local variables.
    Operation codes BEGSR, DUMP, EXSR, GOTO, RESET, TAG.

    That would indicate that if you define the file globally, as opposed to with the main procedure, then it should be fine.

    Comment


    • #3
      The restriction sounds arbitrary, but I assume there must be some underlying technical reason for it.

      Thanks

      Comment


      • #4
        Does it work if you define the file outside of the procedure?

        Comment


        • jtaylor___
          jtaylor___ commented
          Editing a comment
          I didn't try, but I assume it would. I just went "old school" and made do without ON-EXIT.

      • #5
        So you used something like CEE4RAGE or CEERTX? That's what I used to do before ON-EXIT was added

        Comment


        • jtaylor___
          jtaylor___ commented
          Editing a comment
          Nothing that fancy. I just made a private subroutine and did a EXSR before every return.
      Working...
      X