Microsoft KB Archive/35728

From BetaArchive Wiki

How to Invoke "_MSCURPOS" COBOL 3.0 Extension Subroutine

PSS ID Number: Q35728 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 "_MSCURPOS" replaces the extension “CURPOS” found in earlier Microsoft COBOL 2.x Versions. This extension subroutine may be called from a COBOL program to check to see where the cursor is located on the screen. The syntax for this call given in 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 variables Line-val and Col-Val are used to return the line and column position of the cursor. These two variables must be defined with PIC 99 usage comp-0. The following is a code example: DATA DIVISION. WORKING-STORAGE SECTION. 01 CUR-LOC. 02 LIN-VAL PIC 9(2) COMP-0. 02 COL-VAL PIC 9(2) COMP-0. 01 CUR-DISP. 02 LIN-DISP PIC 9(2) COMP-5. 02 COL-DISP PIC 9(2) COMP-5. PROCEDURE DIVISION. MAIN. CALL "_MSCURPOS" USING BY REFERENCE LIN-VAL, BY REFERENCE COL-VAL. MOVE LIN-VAL TO LIN-DISP. MOVE COL-VAL TO COL-DISP. DISPLAY “LINE” LIN-DISP. DISPLAY “COLUMN” COL-DISP. STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.