PreviousUsing Adiscf Mouse Support for Character InterfacesNext"

Chapter 7: Keyboard Configuration Utility (Keybcf)

The Keyboard Configuration Utility, Keybcf, enables you to change the functions assigned to the keys on your keyboard. You can change the action performed by keys during execution of an ACCEPT statement, the keys used by Animator and the function keys used by your own programs.

7.1 Overview

Normally, the default keys built into Adis should not need changing. However, you may need to change the keys used to emulate a particular dialect of COBOL.

The default set of keys used by your COBOL system is built into Adis. Keybcf creates a file called cobkeymp which contains the keystrokes that are to be used for function keys and the keys Adis uses during an ACCEPT operation. At run time, Adis checks for cobkeymp in the current directory. If the file is not found, then the COBOL system directories are searched for cobkeymp. If the file is found the set of keys defined in it are used. If not, the default set of keys are used.

7.1.1 The Key Lists

The following lists of keys can be reviewed and altered by Keybcf:

By default, the user function keys are initially disabled. In order to use these function keys during the execution of a program, you must first enable them by calling the x"AF" library routine or by altering the configuration using Adiscf.

The CRT STATUS clause allows you to ascertain which function key was used to terminate an ACCEPT operation. Full details on the use of this clause can be found in your Language Reference.

7.1.2 cobkeymp Tables on UNIX

UNIX:
Values within the tables found in cobkeymp (or as the internal defaults) which begin with the prefix KEY_ represent values that have been translated using the terminfo database and the UNIX terminal handling library. These values are independent of the terminal you are currently using, and thus you can define keys which are not actually present on your particular keyboard.

You do not need to create a different cobkeymp file for each terminal type on your system. Instead, try to ensure that your cobkeymp is suitable for as many different types of terminal as possible. All terminal specific decoding is done by the RTS using the terminfo database. However, you may have to supply alternative keystrokes for those terminals which do not have special function keys. Full details on the KEY_ values are given in your UNIX documentation.

If you decide to have multiple cobkeymp files rather than using the above procedure, you can do this by renaming cobkeymp and then setting up a dd_ environment variable at run time. For example:

dd_cobkeymp=newname

causes the RTS to look for key configuration information in newname.

7.2 Operation

This section tells you how to invoke and use Keybcf .

7.2.1 Invoking Keybcf

To set up your own cobkeymp file using Keybcf, enter the command line:

component

where:

component is the program-name for the system component to be invoked, in this case Keybcf:

DOS and OS/2
Windows
UNIX
keybcf keybcfw keybcf


Note: Where you specify the command line depends upon the operating system you are running in. For example, in Windows and OS/2, if you have created a group for COBOL, you double-click on the appropriate program icon to invoke the component. Full details on the alternative methods of invoking system tools in your environment are provided in the chapter Introduction.


Keybcf searches for a file called cobkeymp in the current directory and then the directories specified by the COBDIR environment variable. If the file is found, you are asked if you want to edit it. Answer "Y" if you want to edit the file or "N" if you want to create a new file based on the default set of keys. If the file is not found, one is created.

7.2.2 Using Keybcf

Keybcf is menu driven. Once it is invoked, it displays its initial menu as shown in Figure 7-1.

To select the option of your choice, press its associated number. The menu for that function is then displayed. These menus are shown in the following sections.



Figure 7-1: The Main Keybcf Menu

7.2.2.1 Reviewing Existing Function Key Definitions

Entering 1 from the main Keybcf menu displays the Review Existing Function Key Definitions menu. This menu is shown in Figure 7-2.



Figure 7-2: The Review Existing Function Key Definitions Menu

This menu enables you to list all currently defined function keys in one of four sets: Adis, Animator, user or compatibility. To output the list of your choice, press its associated number. For example, press 2 to output the list of Animator function keys, or 4 to output the list of compatibility keys.

Option 5 is a toggle to determine whether a selected list is shown on the screen or written to a file. If you select the screen as the destination, all the currently defined function keys in that list are displayed together with their hexadecimal values. To page from one screen to the next, press any key. Once the end of the list is reached, press any key to return to the Review Existing Function Key Definitions menu.

If you select to output the list to file, the same information is written to a file called keylist.dmp. This happens without further intervention unless the file keylist.dmp already exists, in which case you are asked whether to overwrite it or append this list to the end. Press "O" to overwrite, "E" to extend.

Press 6 to return to the main Keybcf menu.

7.2.2.2 Altering Function Key Definitions

Entering 2 from the main Keybcf menu displays the Alter Function Key Definition menu in which you are prompted to choose the set of function keys you wish to alter. This menu is shown in Figure 7-3.



Figure 7-3: The Alter Function Key Definition Menu

As with the Review Existing Function Key Definitions menu, you can select the Adis, Animator, user or compatibility function key lists. When you have made your selection, a screen for that selection is displayed. As an example, Figure 7-4 shows the screen for Adis key list.



Figure 7-4: The Alter Menu for the Adis Key List

Each function in the function key list you select is displayed individually. For example, the function displayed in Figure 7-4 is Terminate accept. To enter a new function key press the key you want to perform the function, or use X to enter the hexadecimal code for the key. Once you have entered the new key, the program automatically cycles to the next function after a slight pause. The following keys are available on this menu:

Key
Description
Space Cycles from one function to the next, without altering the key defined for each function.
Insert Adds another key to perform the displayed function, but retains the currently defined function key. The word Insert is displayed at the bottom right of the screen.
Delete Deletes a defined function key from a list. Keybcf automatically cycles to the next function.
HeX Specifies that you will enter the hexadecimal sequence for the required function key. The word Hex is displayed at the bottom right of the screen. If you enter an invalid hexadecimal sequence you receive an error when you attempt to cycle to the next function and you are prompted to enter a valid sequence. This function allows you to define keys which may not actually appear on the keyboard you are using, but will be available on the one on which your program will run.
Quit Returns to the Alter menu.

If you attempt to define a large number of keys you may exceed the limit, in which case you receive the warning:

There is not enough room for that sequence

Should this occur, the only way to add additional keys is to delete unwanted key sequences.

Press 5 to return to the Keybcf main menu.

UNIX:
Your UNIX documentation contains details on the values for the KEY_ mnemonics . These are 16-bit values, but you can enter them as three 8-bit codes by typing:

FF, high-byte, low-byte

For example, KEY_DOWN has octal value 0402, or hexadecimal value 102. You can enter a code for KEY_DOWN by typing the three bytes:

FF, 01, 02

Alternatively, if you press the down arrow key on your keyboard your system enters these three bytes for you.

7.2.2.3 Saving Function Key Definitions

If you want to save any alterations you have made to any of the function lists, press 3 from the Keybcf main menu. This saves the changed function lists to a file called cobkeymp.

7.2.2.4 Exiting from Keybcf

Press 4 from the Keybcf main menu to return to the operating system command line.

Example

The following example shows how to use Keybcf to alter the Animator key list. It describes the steps required to insert, delete and change key definitions. The example assumes that the file cobkeymp has not been previously created and hence the values shown by Keybcf are the defaults.

  1. Invoke Keybcf. See the section Invoking Keybcf earlier in this chapter for details on how to do this.

  2. Press 2 from the Keybcf main menu to display the Alter Function Key Definition menu.

  3. Press 2 to specify that you want to alter the Animator key list.

    The screen for Animator function key 1 appears.

  4. Press D to delete the definition of this key.

    The screen for function key 2 now shows.

  5. Press Space to skip over the key definition and continue to do so until the screen for Cursor Up appears.

  6. Press Ctrl and U. The hexadecimal value corresponding to Ctrl+U appears as the definition of Cursor Up. This has now replaced the old value of Cursor Up.

    The screen for Cursor Down now appears.

  7. Press I to insert a definition and then press Ctrl +D. The hexadecimal value for Ctrl+D appears. The next screen is then displayed showing the value for Cursor Down which already exists, that is, there are now two definitions available for Cursor Down.

  8. Press Q to quit and return to the Alter Function Key Definition menu.

  9. Press 5 to return to the Keybcf main menu.

  10. Press 3 to save the new function key definitions. This creates the cobkeymp file.

  11. You can review the changes you have just made by pressing 1. This enters the Review Existing Function Key Definitions menu. Press 2 from this menu to review the Animator key list definitions. This shows the values of all keys in the Animator key list and contains the new values entered.

  12. Press 6 to return to the Keybcf main menu when you have reviewed all of the Animator function keys.

  13. Press 4 to exit from Keybcf.

In order to demonstrate the changes you have just made using Keybcf, it is necessary to invoke Animator. See the chapter Animator in your Object COBOL Character Tools for instructions on invoking Animator.

After entering Animator, the Animator screen appears.

When you press:

Key
Description
F1=Help Nothing happens because the definition of Animator function key 1 was deleted.
<up-arrow> Nothing happens because the definition of <up-arrow> was changed.
Ctrl+U The cursor moves up one line. This is because Ctrl+U was mapped onto the function to move the cursor up one line.
<down-arrow> This still moves the cursor down one line.
Ctrl+D This also moves the cursor down one line because Ctrl+D was inserted as a new definition, and the old definition (<down-arrow>) was retained.

The defaults can be recovered by either using Keybcf and returning the key definitions to their old values, or by simply deleting cobkeymp.

7.2.3 Standard Adis Key Functions

- Terminate Accept

This function terminates an ACCEPT operation. The first byte of any CRT STATUS field (defined as pic 9 display) is set to the character "0" (ASCII 48) and the second byte (defined as PIC 9(2) COMP-X) is set to 0.

- Terminate Program

If enabled, this function causes the Abort confirmation message to be output to the screen and a character requested from the user. If the user responds with anything other than "Y" or "y", the message is blanked and normal processing of the ACCEPT operation continues. If the user presses "Y", or "y" or no message is configured, the program is terminated as if a STOP RUN had been executed.

- Carriage Return

The cursor is moved to the first character position that occurs within a field at or after column one on the next or subsequent line of the screen. If there is no such field, no action takes place.

- Cursor Left

Moves the cursor to the previous character in the field. If the current character is the first character of the field, the cursor is moved to the last character of the preceding field. If the current character is the first character of the first field on the screen, an error is signalled to the user.

- Cursor Right

Moves the cursor to the next character in the field. If the current character is the last character of the field, the cursor is moved to the first character of the next field. If the current character is the last character of the last field on the screen, an error is signalled to the user.

- Cursor Up

The cursor is moved to the next unprotected character position; that is, a position that occurs in a field in direct line above the current position.

- Cursor Down

Moves the cursor to the next unprotected character position in direct line below the current position.


Note: For cursor up and cursor down (functions 5 and 6), cursor movement functions follow the same rules as items defined using the CURSOR IS clause if a position is found that is within a field but is protected by virtue of containing an insertion character or a suppressed numeric digit. In such situations the cursor is moved right to the first unprotected character position within that field. If all such positions are protected, the cursor is moved to the last unprotected character position within the field.


- Move to the Start of the Screen

Moves the cursor to the first unprotected character position of the current screen.

- Move to Next Tab Position

Moves the cursor to the next column Tab stop position. The cursor is never moved forward further than the first available character position after the end of the current field (or line in multi-line fields).

- Move to Previous Tab Position

Moves the cursor to the previous column Tab stop position. The cursor is never moved back further than the last available character position before the start of the current field (or line in multi-line fields).

- End

Moves the cursor to unprotected character positions in the order:

  1. The last character position of the current line in a multi-line alphanumeric field.

  2. The last character position of the current field.

  3. The first character position of the last field on the current screen.
- Move to Next Field

Moves the cursor to the first unprotected character position of the next field on the screen. If already in the last field and auto-skip out of an ACCEPT is not enabled for this key, the cursor is positioned to the last character of the field and the request is considered to have been unsuccessful.

- Move to Previous Field

Moves the cursor to the first unprotected character position in the current field. If the cursor is already at the first position, it moves to the first character position of the previous field. If the cursor is already at the first character of the first field, the request is considered unsuccessful.

- Change Case of Current Character

Retrieves the character at the current cursor position, changes its case if alphabetic and processes it as if it were just keyed. The function is not permitted in numeric or Kanji fields. Changing case on a non-alphabetic character is treated as equivalent to simply typing the character again. The function cannot be used to override the fold to upper-case mechanism which simply re-inverts the case if an attempt is made to fold a character to lower-case.

- Backspace Character

Moves the cursor to the unprotected character position logically preceding the current one, pushes the character there into the retype buffer and replaces it with one popped from the restore buffer. When in insert mode, removal is achieved by moving the remaining characters in the field along one position and popping a character from the overflow buffer to occupy the gap at the end.

In either case, if the relevant buffer is empty or the next character is not valid for the field, a space or zero (according to type of field) is used. Action is slightly different when to the left of the decimal point in numeric fields, but the logical effect is the same - that of reversing the effect of typing a character.

One unusual effect emanating from the logical requirements is that where the cursor was unable to move out of a field when a character was keyed into the last position, the cursor is not moved prior to character replacement.

- Retype Character

Pops a character from the restore buffer and proceeds as if it had been received from the keyboard. An error is signalled if the buffer is empty or the character is illegal in the current field.

- Insert Single Character

Places a space or zero character (according to the field type) under the current cursor position, making room for it by shuffling characters along the field. Except when to the left of the decimal point in numeric fields, significant characters can be pushed off the end (the character that is lost is pushed into the overflow buffer and an error is signalled to the user). When to the left of the decimal point in a numeric field, an attempted insertion is unsuccessful if a significant digit would otherwise be lost or if the cursor is on the leftmost digit position (since the functionality of numeric insertion operations in these circumstances implies a requirement to insert before the current digit).

- Delete Character

Pushes the character currently under the cursor into the restore buffer, moving the remaining characters in the field left by one position and pops a character from the overflow buffer to occupy the gap at the end. If the overflow buffer is empty, a space or zero (according to type of field) is used.

Action is slightly different when to the left of the decimal point in numeric fields, but the logical effect is normally the same - that of reversing the effect of inserting or restoring a character. If the field is numeric, the character is discarded and not pushed into the restore buffer.

- Restore Character

The effect and restrictions of this function are identical to insert character (function 16 above) except that the character to be inserted is popped from the restore buffer. An error is signalled if the buffer is empty or if the character popped is not valid in the current field. This function is not available in numeric fields.

- Clear to End of Field

Characters at, and to the right of, the current cursor position in the current field are pushed into the restore buffer and replaced by spaces or zeros (according to the type of field). Operation is from left to right and includes trailing nonsignificant spaces and zeros. The cursor does not move. Multi-line alphanumeric fields are treated as being split at line boundaries for the purposes of this operation.

- Clear Field

The entire contents of the current field (or the current line in the case of a multi-line alphanumeric field) are pushed into the restore buffer as for clear to end of field on the first character position. The field then has spaces (alphanumerics) or zeros (numerics) moved to it and the cursor is placed on its initial position as defined for the type and format of the field.

- Clear to End of Screen

The action defined for clear to end of field is performed on the current field (or line), and the following fields have spaces or zeros moved to them, as appropriate.

- Clear Screen

All fields on the screen have spaces or zeros (as appropriate) moved to them and the cursor is moved to its home position (the first unprotected character of the first field). The restore and retype buffers are cleared by this function.

- Set Insert Mode

Sets the current editing mode to insert and displays or clears any relevant configured indicators. Any Off end of field indicator is cleared by this function.

- Set Replace Mode

Sets the current editing mode to replace, and displays or clears any relevant configured indicators. Any Off end of field indicator is cleared by this function.

The concept of insert mode and replace mode apply only in alphanumeric fields. The mode flag is therefore suppressed while in numeric fields and reinstated on moving to another alphanumeric field.

Replace mode is sometimes known as overtype mode.

- Undo

Reinstates the current field (or line) to its state when the cursor last moved into it. Operations involving hidden MOVE operations out of the current field (clear screen, clear to end of screen) can cause edits to cease to be undoable as well as the more obvious operations such as field-tab and auto-skip out.

- Home

Moves the cursor to unprotected character positions in the order:

  1. The first character position of the current line in a multi-line alphanumeric field.

  2. The first character position of the current field.

  3. The first character position of the current screen.

7.2.3.1 Special Mapping Functions

- RM Clear Field

This function is provided for RM compatibility. During an ACCEPT operation, if the UPDATE clause is specified, a Cursor Home (function 7) is performed, otherwise Clear Field (function 20) is performed.

- RM Backspace

This function is provided for RM compatibility. During an ACCEPT operation, if the UPDATE clause is specified, a Cursor Left (function 3) is performed, otherwise Backspace Character (function 24) is performed.

- RM Tab

This function is provided for RM compatibility. During an ACCEPT operation, if the UPDATE clause is specified, a Terminate Accept (function 0) is performed, otherwise there is no action.

- Insert Toggle

If the current mode is insert mode, Set Replace Mode (function 24) is performed, otherwise Set Insert Mode (function 23) is performed.

- Replace Toggle

If the current mode is replace mode, Set Insert Mode (function 23) is performed, otherwise Set Replace Mode (function 24) is performed.

- Forward Tab

If in a multi-field ACCEPT, Move to next field (function 11) is performed, otherwise Move to next tab stop (function 8) is performed.

- Backward Tab

If in a multi-field ACCEPT, Move to previous field (function 12) is performed, otherwise Move to previous Tab stop (function 9) is performed.

- Restore

If the current field is numeric or the restore buffer is empty, Insert Single Character (function 16) is performed, otherwise Restore Character (function 18) is performed.

- Undefined Mapping

This value is used if no key has been set up for a particular function.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousUsing Adiscf Mouse Support for Character InterfacesNext"