Highlighted
Absent Member.
Absent Member.
1581 views

Visual COBOL Generate KeyStroke.

Is there any way to generate KeyStroke programatically to move cursor control to the next field. The same feature was handled by the TAB key. Client's requirement is to validate each of the fileds in the screen and if validation success it automatically highlight the next fileds. During validation control is back to the program level but how again is it possible to retrieve the screen with very next field activated. Please help.

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Partha,

You haven't given any infiormation on how the user interface fields are implemented so it will be difficult for anybody to give you a definitive answer. Is the code using SCREEN SECTION, Dialog System, Windows Forms or something else ?

If it is SCREEN SECTION you could set the TAB key to terminate the accept, using the key mappings in ADISCF, use the CURSOR IS clause to determine which field you were on, do the required validation and then redo the ACCEPT/DISPLAY with the CURSOR positioned at the rquired field by updating the CURSOR IS value.

Gael

0 Likes
Highlighted
Absent Member.
Absent Member.

yes Gael I am using the Screen Section but could you please explain more on CURSOR IS clause as it can take the position of next field right?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Partha,

The CURSOR IS is defined in the SPECIAL-NAMES paragraph of the CONFIGURATION SECTION of the ENVIRONMENT DIVISION of your program containing the SCREN SECTION. The following is from the product documentation :

CURSOR IS data-name-1

The CURSOR IS clause specifies the data item to contain the cursor address used by the ACCEPT statement.

At the start of an ACCEPT statement, if data-name-1 contains a value that is a valid character position on the screen, that position is used as the initial position for the cursor. Otherwise, data-name-1 is ignored, and the initial position for the cursor is the start of the first input field on the screen. At the end of an ACCEPT statement, if the position in data-name-1 has been used in that statement, data-name-1 is updated to show the position of the cursor at the termination of the ACCEPT statement.

CURSOR IS has no effect on the positioning of fields on the screen.

Data-name-1 must be 4 or 6 characters in length. If data-name-1 is 4 characters in length, the first two characters are interpreted as line number, and the second two as column number. If data-name-1 is 6 characters in length, the first three characters are interpreted as line number, and the second three as column number.

The clause has no effect if data-name-1 contains an illegal position (for example, zeros, a nonnumeric value, or a value that is beyond the bottom of the screen).

If data-name-1 contains a valid position that does not correspond to an input field being accepted by the current ACCEPT statement, the cursor is positioned to the next such field or, if there is none, to the first such field. The ordering of the fields is the order in which their descriptions appear in the Data Division.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.