Microsoft KB Archive/31233

Assembly Routines with Labels on END Directives Do Not Compile

PSS ID Number: Q31233 Article last modified on 04-21-1993

2.20 MS-DOS

Summary: CALLed assembly routines that specify a label on the END directive do not execute as desired under Microsoft COBOL Version 2.2. Although versions of COBOL earlier than Version 2.2 allowed a label on the END directive in the CALLed assembly-language program, Version 2.2 prohibits this construct. To work around this problem, remove the label on the END directive in the assembly-language routine.

More Information: When the linker creates an executable program, it examines each successive .OBJ file and determines whether that file has a specified entry point. The first .OBJ file that specifies an entry point is assumed by the linker to be the main program, and program execution will begin there. The COBOL compiler does not provide an entry point to compiled source files. However, the label on the END directive of the assembly routine provides such an entry point, which means that execution begins in the assembly routine, bypassing the COBOL CALLing program. When the assembly routine completes and attempts to execute its RETURN statement to return to its CALLing counterpart, the machine locks because the CALLing routine was never loaded. Microsoft has confirmed this to be a problem in Version 2.2. We are researching this problem and will post new information as it becomes available. The following code demonstrates this problem:. . pop bp ret end_cseg subit <— FAILS end bob The following code demonstrates the workaround for this problem:. . pop bp ret end_cseg subit end <— WORKS!

Additional reference words: 2.20 Copyright Microsoft Corporation 1993.