Microsoft KB Archive/32154

G Switch Forces 512-Byte Buffer Size (Versus 4096) at Run Time

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

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

Summary: In Microsoft COBOL Version 3.0, 3.0a, 4.0 or 4.5, files with ORGANIZATION LINE SEQUENTIAL or SEQUENTIAL, or files with an ACCESS MODE SEQUENTIAL clause, will by default allocate file buffers of 4096 bytes. [For example, a RELATIVE file with ACCESS MODE SEQUENTIAL (and no sharing) allocates 4096 bytes.] All other files have buffers of 512 bytes. When memory is at a premium, such as when running inside the animator, the G switch can be set to force all buffers to be 512 bytes. If a program uses more than seven SEQUENTIAL or ACCESS mode SEQUENTIAL files, this setting may alleviate some memory problems. However, the program will save and retrieve information more slowly and write to the disk more frequently, which may impact performance. The G programmable switch is documented on Page 5-5 of the “Microsoft COBOL Compiler Version 3.0: Operating Guide.”

More Information: If more than one file buffer region is being allocated, using the G switch can help eliminate some memory fragmentation problems. A new file buffer region is allocated when more than seven SEQUENTIAL or ACCESS MODE SEQUENTIAL files are being OPENed simultaneously during the program. More files can be OPENed and have buffers allocated in one buffer region if the buffer size is set to 512 bytes with the (+G) switch. For more information about buffer regions, memory management, and memory fragmentation, query on the following words: fragmentation and IXSIO and ADIS and CALL and CANCEL and COBOL The smaller (512-byte) buffer can be forced for all access modes, including sequential, by using the run-time switch “+G”. For example: MYPROG (+G) or ANIMATE (+G) MYPROG; (to run MYPROG.EXE in the ANIMATOR)

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