Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/35727

From BetaArchive Wiki

How to Invoke "_MSKBDAVAIL" COBOL 3.0 Extension Subroutine

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

3.00 | 3.00 MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, version 3.0

Summary: The Microsoft COBOL Version 3.0 extension subroutine "_MSKBDAVAIL" replaces the extension “KBDAVAIL” found in earlier Microsoft COBOL 2.x Versions. This extension subroutine may be called from a COBOL program to check to see whether a key as been pressed. The syntax given for this call in the file MS2-2.DOC (found on the Setup disk) will cause the compiler to issue the following error message: Call parameter is literal (or LENGTH of) By content assumed Despite this warning message, the generated code may be used successfully. The sample program below works correctly and generates no error messages when compiled with the ANS85 directive.

More Information: In the example below, the returned value in MY-STATUS will be “00” if a key has been pressed or “30” if no keyboard data has been entered. The following is a code example: DATA DIVISION. WORKING-STORAGE SECTION. 01 MY-STATUS PIC 99. PROCEDURE DIVISION. MAIN. DISPLAY “PRESS A KEY TO CONTINUE” MOVE 30 TO MY-STATUS. PERFORM UNTIL MY-STATUS = 0 CALL "_MSKBDAVAIL" USING BY REFERENCE MY-STATUS END-PERFORM IF MY-STATUS = “00” DISPLAY " A KEY HAS BEEN PRESSED " STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.