Microsoft KB Archive/39364

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:22, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q39364 to Microsoft KB Archive/39364 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to Position the Cursor in COBOL Version 3.0

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

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

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

Summary: The CURSOR IS clause, which appears in the SPECIAL-NAMES SECTION, allows you to position the cursor in the field of your choice at the start of ACCEPT statement. The last location of the cursor is recorded in the CURSOR IS data group after the ACCEPT. This feature is used in conjunction with the SCREEN SECTION.

More Information: The example program below demonstrates how to use the CURSOR IS clause. To position the Cursor, move the line and column values to the Cursor-Row and the Cursor-Column fields prior to the ACCEPT statement. If the values moved into the data item identified by the CURSOR IS clause are not valid field values, the cursor will be positioned at the beginning of the first field in the ACCEPT screen. The following code example shows how to position the cursor on the last field. It may be compiled and LINKed accepting the defaults:

  $set ANS85
   SPECIAL-NAMES.
     CURSOR IS CURSOR-POSITION.
   WORKING-STORAGE SECTION.
   01 Cursor-Position.
       03 Cursor-Row          PIC 99.
       03 Cursor-Column       PIC 99.
   01 SCREEN-FIELDS.
       03 WS-NAME          PIC X(20)     VALUE "JOHN DOE".
       03 WS-STREET        PIC X(20)     VALUE "EASY STREET".
       03 WS-STATE         PIC X(2)      VALUE "WA".
   SCREEN SECTION.
   01  DISPLAY-SCREEN.
       03        BLANK SCREEN.
       03        LINE 3 COLUMN 4             VALUE "NAME:".
       03        LINE 3 COLUMN 15 PIC X(20)  USING WS-NAME.
       03        LINE 5 COLUMN 4             VALUE "STREET:".
       03        LINE 5 COLUMN 15 PIC X(20)  USING WS-STREET.
       03        LINE 7 COLUMN 4             VALUE "STATE:".
       03        LINE 7 COLUMN 15 PIC X(2)   USING WS-STATE.
   PROCEDURE DIVISION.
   MAIN.
         MOVE 7  TO Cursor-Row.
         MOVE 15 TO Cursor-Column.
         DISPLAY DISPLAY-SCREEN.
         ACCEPT DISPLAY-SCREEN.
   STOP RUN.

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