Microsoft KB Archive/32984

Version 3.0 Cursor Placement with Full-Screen DISPLAY/ACCEPT

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

1.07 1.10 1.12 2.00 2.10 2.20 3.00 3.00a 4.00 4.50 | 3.00 3.00a 4.00 4.50 MS-DOS | OS/2

Summary: In all versions of the Microsoft COBOL Compiler earlier than Version 3.0, it is not possible to position the initial input cursor in any but the first field on an ACCEPTed screen. Microsoft COBOL Version 3.0 includes this feature as a product enhancement.

More Information: The CURSOR IS clause in COBOL Versions 3.0, 3.0a, 4.0, and 4.5 allows a programmer to specify precisely where in a field/screen the cursor is to be positioned at the start of the ACCEPT. The CURSOR IS clause also returns the final cursor position when the ACCEPT is complete. For example, define the CURSOR IS clause in the SPECIAL-NAMES paragraph, as in the following example: SPECIAL-NAMES. CURSOR IS Cursor-Position. where Cursor-Position is a field defined in the WORKING-STORAGE SECTION, as in the following example: 01 Cursor-Position. 05 Cursor-Row PIC 99. 05 Cursor-Column PIC 99. Whenever an ACCEPT is executed, ADIS will attempt to initially position the cursor at the position specified in Cursor-Position. If the position specified is invalid (i.e., either Cursor-Row or Cursor-Column does not contain a valid value), the cursor is positioned at the start of the first field on the screen. If the value in Cursor-Position is valid, ADIS will search through all of the fields to see if the requested cursor position lies within one of the fields. If a field is found, the cursor is positioned at the specified point within that field. If it does not, then the cursor is positioned at the start of the first field. Therefore, if you want the cursor to be positioned at the start of the first field, setting both Cursor-Row and Cursor-Column to 1 will achieve this goal. When the ACCEPT is terminated, if the value in Cursor-Position at the start of the ACCEPT is valid, the position of the cursor when the terminating key was pressed is returned in Cursor-Position. Please note that this may not be the same position in which the cursor is currently positioned. ADIS usually moves the cursor to the end of the field upon termination of an ACCEPT to allow relative positioned ACCEPT statements to start at the correct point on the screen. For additional information on the CURSOR IS clause, please see the “Microsoft COBOL Compiler Version 3.0: Language Reference Manual,” Pages 15-5 through 15-6.

Additional reference words: 1.07 1.10 1.12 2.00 2.10 2.20 3.00 3.00a 4.00 4.50 Copyright Microsoft Corporation 1993.