Microsoft KB Archive/63917

How to Do Serial Communications in OS/2 COBOL (Available)

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

3.00 3.00a OS/2

Summary: A file, named COBCOM, available in the Software/Data Library gives a complete program showing how a Microsoft COBOL Compiler version 3.0 or 3.0a program can do serial communications under MS OS/2. COBCOM can be found in the Software/Data Library by searching on the word COBCOM, S12626, or the Q number of this article. COBCOM was archived using the PKware file-compression utility.

More Information: Microsoft COBOL versions 3.0 and 3.0a protected mode programs can perform serial communications by calling the following OS/2 API functions:

Microsoft COBOL versions 3.0 and 3.0a can call OS/2 API functions directly with the CALL statement by preceding the name of the function with a double underscore (__) and linking with the PCOBOL.LIB and DOSCALLS.LIB libraries. Because API functions use a calling convention that is the reverse of COBOL’s, any parameters must be passed in the reverse order. The sample program in the Software/Data Library demonstrates how a protected mode COBOL program can call the API functions mentioned above to perform serial communications. When run on two computers connected with a null-modem cable, the sample program will take any keyboard input and send it to the other computer via the COM1 (or COM2) serial port. It will also read input from the serial port and display it on the screen. This is known as a “dumb-terminal” emulation program. For more information on calling OS/2 API functions from COBOL, see the file OS2API.DOC included with COBOL 3.0a. For more information on the API functions mentioned above, see Pages 506, 510, 537-539, 553-554, 572, and 621-622 of “Advanced OS/2 Programming” by Ray Duncan (Microsoft Press, 1989).

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