Microsoft KB Archive/58826

From BetaArchive Wiki

“R013 - Illegal Intermediate Code” in COBOL Version 3.0a

PSS ID Number: Q58826 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, versions 3.0 and 3.0a

Summary: The following code example produces “R013 - illegal intermediate code” during compilation: WORKING-STORAGE SECTION. 77 L PIC 99. 77 myvar pic s9. PROCEDURE DIVISION. MULTIPLY -1 BY myvar. DISPLAY “test” LINE L. stop run. Microsoft has confirmed this to be a problem in Microsoft COBOL versions 3.0 and 3.0a for MS-DOS and MS OS/2. This problem has been corrected in Microsoft COBOL Professional Development System version 4.0 for MS-DOS and MS OS/2.

More Information: When the program is compiled using only the default compiler directives (no COBOL.DIR), as follows COBOL R013.COB; The following error is generated: * Checking complete with no errors - starting code generation * NCG Error at Int Code Address - XXXX * R013 - Illegal intermediate code. The problem disappears if any one of the following conditions is met: 1. Comment or remove the MULTIPLY line. 2. Comment or remove the DISPLAY line. 3. MULTIPLY by 1 instead of -1. 4. Don’t use LINE L, use LINE literal, such as DISPLAY “test” LINE 10. Since the variable L may be used throughout your program and may be read in from a file or input by the user, changing this is not a usable solution, as are options 1 and 2 above. To work around this problem, you can use the COMPUTE statement. Since the code gets the negative of the data-item, you can subtract the data-item from 0 (zero) to get the same result, as follows: WORKING-STORAGE SECTION. 77 L PIC 99. 77 myvar pic s9. PROCEDURE DIVISION. * MULTIPLY -1 BY myvar. * use compute and subtract from 0 to get the negative. compute myvar = 0 - myvar. display “test” line L. stop run.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.