X"B0" function 0

Creates a function-key table.

Note: This routine is supported for native COBOL only.

Syntax:

call X"B0" using function-code
                 key-table

Parameters:

function-code
Call prototype: cblt-x1-compx
Picture: pic x comp-x.
key-table
Group containing:
01 key-table
  03 key-pressed     cblt-x1-compx   *> pic x comp-x. 
  03 key-entry-list                  *> Group item defined as one iteration
                                     *> of the following for each key to be
                                     *> detected:   
    05 key-entry-len cblt-x1-compx   *> pic x comp-x. 
    05 key-entry     pic x(n)        *> pic x(n) 
  03 key-list-end    cblt-x1-compx   *> pic x comp-x. 

On Entry:

function-code Contains 0.
key-entry-len The length of key-entry in bytes (1 or 2).
key-entry The code sequence produced by the required key.
key-list-end Contains 0.

On Exit:

key-pressed The table entry matching the key used, or zero if no match is made.

Comments:

An ACCEPT statement normally recognizes as control keys only the keys used in data entry and is terminated by the Enter key; any other control key is rejected with a beep. Other control keys and function keys can be made available by calling this library routine.

This routine declares a table of key-code sequences, one for each additional key which is to be recognized. Details of the code sequences sent by each key are available in the IBM Personal Computer Technical Reference Manual.

After the routine has been called, an ACCEPT statement is terminated by the Enter key or by any one of the keys whose code sequence matches an entry in the table. The first byte of the table then contains a number indicating which entry in the table has been matched; zero indicates that the Enter key was used. If the Enter key has an entry in the table, the entry number of that key is returned rather than zero.

The routine can be called with different tables as often as you require. If the current table is changed (for example, if a key is changed or the length increased), then you don't need to call the routine again.

A table used by a particular program remains enabled for that program until it is superseded by another call to this routine, regardless of how many times this routine is called by other programs in your suite.

You must explicitly set up a table for each program in your suite of programs that uses this facility; passing the table in the Linkage Section is not sufficient.

As long as you know the key-code sent, you can define any key in the table. For example, a table entry with length of 1 and a key-code of pic X VALUE "C" causes the letter C to end an ACCEPT. You could, therefore, use such a key to "break-out" of an ACCEPT, perform your own processing, and return to the ACCEPT statement. The effect of this is that you have redefined the effect of that particular key.

The result byte is set both on termination of an ACCEPT and on each call to the routine when a key in the defined table has been pressed. When this occurs, the character code, x"0D" is returned to the CBL_READ_KBD_CHAR routine, and the result byte indicates which key in the table has been pressed. This means that, you can use CBL_READ_KBD_CHAR to read any single keystroke, including function keys.

For a complete list of code sequences sent by keys, see the technical reference manual for your personal computer.

Any keys defined by this call take precedence over those defined with AdisCF.

The function key table set up by AdisCF and used by call x"AF" is separate from the function key table used by call x"B0". Both can be enabled at the same time with all key sequences in the x"B0" table causing the carriage return x"0D" character to be returned to Adis.