Microsoft KB Archive/33232

Interrupts for Network Detection/Record Locking, COBOL 3.0

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

3.00 | 3.00 MS-DOS | OS/2

Summary: The MS COBOL Version 3.0 run time detects the presence (or absence) of a network when executing the first OPEN of a file by examining the return of the network function call (interrupt 21 hex, function 3D hex) to get a semaphore on the file. If a network is detected, the file is opened in shared mode. This action also affects subsequent operations, such as buffering. File buffering is still performed, but buffers are refreshed at the start of any file operation and flushed at the end of the file operation. For any given record, Microsoft COBOL uses the MS-DOS interrupt 21 hex, function 5C hex to lock an area of the file corresponding to the actual COBOL record. For this we take the actual record offset (32 bits), add 8000000 hex to it, and lock the first byte of the area (i.e., the top bit of the 32-bit offset of the file is set on). This will lock a nonexistent part of the file. We do this is so that we can lock records and yet still return the data areas to the COBOL program. MS-DOS does not object to this technique (although clones may object). On MS OS/2, COBOL Version 3.0 makes use of the DOSOPEN and DOSFILELOCKS API routines.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.