COBCH1949 Cannot access object file from a static method or field

When inside a static method, only a file that is itself marked as static can be referenced.

In the following example, the file description for f1 is marked static, and so is accessible; the file description for f2 is not.

       class-id a.
       file-control.
       select f1 assign "MyFile".
       select f2 assign "MyFile".
       file section.
       fd f1 static.
       01 r1 pic x.
       fd f2.
       01 r1 pic x.
       method-id main static.
           open output f1            *> This is OK
           open output f2            *> This produces the error
       end method.
       end class.