Previous Topic Next topic Print topic


Keyboard Routines - Example

The following code is an example of how to use the function key call together with CBL_READ_KBD_CHAR:

 procedure division.
     ...
* Set up function key list
     call x"B0" using B0-function
                      B0-parameter-block
     ...
* Read a character from the keyboard
     call "CBL_READ_KBD_CHAR" using char
     if char = x"0D"

* A key defined in the function key table was pressed
         evaluate B0-return-byte
           when 1
            ...
           when 2
            ...
         end-evaluate
     else
         if char = x"00"
* A function key not defined in the table was pressed
             call "CBL_READ_KBD_CHAR" using char
* char contains the key's scan code
            ...
         else
* char contains a character
            ...
         end-if
     end-if. 
Previous Topic Next topic Print topic