X"B0" function 2

Tests the status of the Shift, Alt, Ctrl and Lock keys.

Note: This routine is supported for native COBOL only.

Syntax:

call X"B0" using function-code
                 status-block

Parameters:

function-code
Call prototype: cblt-x1-compx
Picture: pic x comp-x.
status-block
Group containing:
01  status-block
  03 status-inds  pic x           *> pic x 
  03 status-id    cblt-x1-compx   *> pic x comp-x. 
  03 status-res   pic x(6)        *> pic x(6)

On Entry:

function-code
Value 2.
status-id
Must be set to 2. It is overwritten by the call, so must be reset to 2 before each call.
status-res
Reserved.

On Exit:

status-inds
Contains bit settings indicating the status of the keys (1=key pressed, 0=key not pressed) in the following order:
bit 7 Ins
bit 6 Caps Lock
bit 5 Num Lock
bit 4 Scroll Lock
bit 3 Alt
bit 2 Ctrl
bit 1 Shift (left key only)
bit 0 Shift (right key only)

Comments:

For the Alt, Ctrl and Shift keys, the routine returns a 1 only if the key is actually pressed when the routine is called; for the other keys, the relevant bit is alternately set and unset each time the key is pressed.

Effective use of function 2 requires that the call is repeated at very frequent intervals.