We created support incident 2878817 for this and I was able to reproduce the problem in a small cutdown managed app so I created an RPI for this and sent to development. There appears to be a problem with the compiler in 2.3 or higher where it is generating incorrect code when there is a constructor containing and open statement and a GO TO. This results in an exception being thrown when the constructor is called that the CLR detected an invalid program. The cutdown code looks like: class-id Amends. INPUT-OUTPUT SECTION. FILE-CONTROL. select test-file assign to "testfile.dat". DATA DIVISION. FILE SECTION. fd test-file. 01 test-record pic x(20). WORKING-STORAGE SECTION. 01 XREPLY PIC X. method-id NEW. procedure division. IN010. OPEN INPUT test-file. IF XREPLY = "X" GO TO IN010. goback. end method. end class. If I comment out either the OPEN statement or the IF statement then the problem does not occur. If I rewrite the code to use perform instead of GO TO then it also works. IN010. perform until exit OPEN INPUT test-file IF not XREPLY = "X" exit perform end-if end-perform goback. I will keep you updated through the support incident. Thanks.
↧