Microsoft KB Archive/42658

From BetaArchive Wiki

COBOL 3.0 SORT Can Hang If Memory Fragmentation Has Occurred

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

3.00 3.00a 4.00 MS-DOS

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

Summary: If memory fragmentation has occurred in a COBOL program, but the program is still able to run, using the COBOL SORT verb can hang the machine, requiring a warm or cold reboot. The program may return the run-time error message “222 SORT/MERGE error: see status key”, but the status key cannot be read because the machine is hung. The programs involved are typically very large. Memory fragmentation is usually caused by CALLing and/or CHAINing with a combination of other factors such as using files that allocate file buffers the first time they are OPENed, using ACCEPTS and DISPLAYS that load ADIS.EXE dynamically, or not having a driver program that does all of the CHAINing. For a detailed discussion on COBOL memory fragmentation and strategies for avoiding it, query on the following words: COBCHAIN, or 198 and FRAGMENTATION Microsoft has confirmed this to be a problem in Microsoft COBOL version 3.0 and 3.0a for MS-DOS, and in Microsoft COBOL Professional Development System version 4.0 for MS-DOS. We are researching this problem and will post new information here as it becomes available.


The program must eliminate the fragmentation to run. All CHAINing must be done from a main driver program. All CHAINed-to programs must CHAIN back to the driver. The driver then chains to the next program in the sequence. Any support modules such as ADIS.OBJ and IXSIO.OBJ must be statically linked to the programs.

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