Enabling or Disabling Shift Keys to Terminate an ACCEPT

By default, all of the shift keys are disabled during an ACCEPT operation, or the x"AF" call used to obtain a key. However, this routine enables you to enable or disable the shift keys dynamically.

Use the following call to enable or disable shift keys:

call x"AF" using    adis-function
                    adis-parameter 

where adis-function and adis-parameter are defined in the Working-Storage Section of your program as follows:

  01 adis-function              pic 9(2) comp-x.
  01 adis-parameter.
     03 shift-key-setting       pic 9(2) comp-x.
     03 filler                  pic x value "4".
     03 first-shift-key         pic 9(2) comp-x.
     03 number-of-shift-keys    pic 9(2) comp-x.
where:
adis-function
is 1.
shift-key-setting
is the action of the keys affected, as follows:
0
the keys are disabled. If the key is pressed it will be ignored.
1
the keys are enabled.
first-shift-key
is the number of the first key to be affected. The events to enable are numbered as follows:
0
Alt pressed
1
Alt released
2
Ctrl pressed
3
Ctrl released
4
Left-shift pressed
5
Left-shift released
6
Right-shift pressed
7
Right-shift released
number-of-shift-keys
is the number of consecutive keys to be affected.

The following code enables Ctrl so that it can terminate an ACCEPT operation, then checks to see whether an ACCEPT operation was terminated by Ctrl:

* Enable Ctrl
      move 1 to shift-key-setting
      move 2 to first-shift-key
      move 1 to number-of-shift-keys
      move 1 to adis-function
      call x"AF" using adis-function
                       adis-parameter
      accept data-item at 0101
      if key-type = "5"
          evaluate key-code-1
           when 2     display "Ctrl pressed"
           when other display "Other shift key pressed"
          end-evaluate 
      end-if.