Operation (cont.) [ Micro Focus COBOL System Reference, Volume 1 ] MPE/iX 5.0 Documentation
Micro Focus COBOL System Reference, Volume 1
Operation (cont.)
Keyboard Handling Via Adis (cont.)
The CRT STATUS Clause (cont.).
Example.
The following code enables the Escape key and function keys F1 and F10,
but disables all other user function keys:
* Enable Escape key
move 1 to user-key-setting
move 0 to first-user-key
move 1 to number-of-keys
call x"AF" using set-bit-pairs
user-key-control
* Disable 126 keys starting from key 1
move 0 to user-key-setting
move 1 to first-user-key
move 126 to number-of-keys
call x"AF" using set-bit-pairs
user-key-control.
* Enable F1 and F10.
move 1 to user-key-setting
* Enable F1.
move 1 to first-user-key
move 1 to number-of-keys
call x"AF" using set-bit-pairs
user-key-control * Enable F10
move 10 to first-user-key
call x"AF" using set-bit-pairs
user-key-control
Detecting User Function Keys.
If you press an enabled user function key during an ACCEPT operation, the
ACCEPT operation is terminated and the fields in key-status are set as
follows:
Data Item Setting
---------------------------------------------------------
key-type "1"
key-code-1 Set to the number of the user key that was
pressed.
key-code-2 Undefined.
Example.
The following code detects which function key is pressed, assuming that
the only enabled function keys are Escape, F1 and F10:
accept data-item at 0101
if key-type = "1"
evaluate key-code-1
when 0
display "escape was pressed"
when 1
display "F1 was pressed"
when 10
display "F10 was pressed"
end-evaluate
end-if.
The Compatibility Key List.
Most of the time, you need to use only the one list of user function
keys. However, if you are converting from another dialect of COBOL, you
might be in the situation where you have some programs that expect the
values returned from the standard user key list and some programs that
expect the values returned by the function keys in some other dialect of
COBOL. To enable you to do this, the compatibility key list is provided.
This works in exactly the same way as the normal key list. Any program
can use either the standard user key list or the compatibility list, but
not both.
By default, a program uses the standard user key list. If you want all
programs in your system to use the compatibility key list, you can use
Adiscf to select its use. If you want different programs to use
different lists, you can insert the following call into your programs to
select the list you require:
call x"AF" using set-bit-pairs key-list-selection
where set-bit-pairs and key-list-selection are defined in the
Working-Storage Section of your program as follows:
01 set-bit-pairs pic 9(2) comp-x value 1.
01 key-list-selection.
03 key-list-number pic 9(2) comp-x.
03 filler pic x value "1".
03 filler pic 9(2) comp-x value 87.
03 filler pic 9(2) comp-x value 1.
where key-list-number should be set to one of the following values:
1 To select the standard user function key list.
2 To select the compatibility key list.
The default compatibility key list included in your COBOL system is set
up to return the values provided by function keys in the UNIX version of
RM/COBOL 2.0.
The User Function Keys and Validation Clauses.
Normally, if a validation clause, such as FULL or REQUIRED, is specified
in an ACCEPT statement, that clause must be satisfied before you can
leave the field. For example, when the statement:
accept data-item with required
is executed, you are not allowed to terminate the ACCEPT operation unless
something has been entered into the field.
However, if an enabled user function key is pressed during an ACCEPT
operation, it is regarded as an exception and terminates the ACCEPT
operation even if the validation clause has not been satisfied. If you
do not want function keys to terminate the ACCEPT operation without
satisfying validation clauses, you can set Accept/Display option 9 using
Adiscf. See the section Altering ACCEPT/DISPLAY Options in chapter Adis
Configuration Utility (Adiscf) for more information.
Using the Adis Keys.
As noted in the section Function Keys, the Adis keys are those keys that
perform functions within an ACCEPT operation such as cursor movement,
delete character, and backspace. However, it is possible to make these
keys terminate an ACCEPT operation.
You must appreciate the distinction between the keys that perform the
functions, and the functions themselves; there is actually a soft mapping
between the keys and the functions they perform. This means that you can
change the function that any of the Adis keys perform.
The Functions Performed by the Adis Keys.
A full list of the functions performed by the Adis keys is given in the
section List of Standard Adis Key Functions in chapter Keyboard
Configuration Utility (Keybcf). Functions 0 through 27 are simple
functions. Functions 55 to 62 are complex functions which can perform
different actions depending on some state. For example, those functions
provided for RM compatibility have a different action depending on
whether or not the UPDATE clause is specified in the ACCEPT statement.
The Adis Keys.
There are 28 Adis keys (numbered 0 through 27) in DOS, Windows and OS/2
environments and 27 (numbered 0 through 26) Adis keys in UNIX
environments. Each key is mapped onto a function, so that when a key is
pressed, it performs the function it has been mapped to. The functions
are described in the section List of Standard Adis Key Functions in
chapter Keyboard Configuration Utility (Keybcf).
What is often confusing is that the Adis keys themselves are given names.
This name is used to distinguish the different keys, but may not
necessarily describe the function the key actually performs. The
following list gives the names of the keys and the keystrokes required to
obtain them. Note that you may have a different configuration for your
environment. Please refer to your Release Notes.
-------------------------------------------------------------------
| | | |
| Key | Function | Default Key/Keystroke |
| Number | | |
| | | |
-------------------------------------------------------------------
| | | | |
| | | DOS, Windows | UNIX |
| | | and OS/2 | |
| | | | |
-------------------------------------------------------------------
| | | | |
| 0 | Terminate ACCEPT | None | Ctrl+J or |
| | operation | | KEY_ENTER |
| | | | |
-------------------------------------------------------------------
| | | | |
| 1 | Terminate program | Ctrl+K | Ctrl+K |
| | | | |
-------------------------------------------------------------------
| | | | |
| 2 | Carriage return | Enter | Ctrl+M (Mapped |
| | | | to 00) |
| | | | |
-------------------------------------------------------------------
| | | | |
| 3 | Cursor left | Cursor Left | KEY_LEFT |
| | | (<-) | |
| | | | |
-------------------------------------------------------------------
| | | | |
| 4 | Cursor right | Cursor Right | KEY_RIGHT |
| | | (->) | |
| | | | |
-------------------------------------------------------------------
| | | | |
| 5 | Cursor up | Cursor Up (^) | KEY_UP |
| | | | |
-------------------------------------------------------------------
| | | | |
| 6 | Cursor down | Cursor Down | KEY_DOWN |
| | | (v) | |
| | | | |
-------------------------------------------------------------------
| | | | |
| 7 | Home | Home | KEY_HOME |
| | | | |
-------------------------------------------------------------------
| | | | |
| 8 | Tab | Tab | Ctrl+I (Mapped |
| | | | to 11) or |
| | | | KEY_TAB |
| | | | |
-------------------------------------------------------------------
| | | | |
| 9 | Backtab | Backtab | Ctrl+L (Mapped |
| | | | to 12) or |
| | | | KEY_BACKTAB |
| | | | |
-------------------------------------------------------------------
| | | | |
| 10 | End | End | KEY_LL or Ctrl+O |
| | | | or KEY_END |
| | | | |
-------------------------------------------------------------------
| | | | |
| 11 | Next field | None | Ctrl+N |
| | | | |
-------------------------------------------------------------------
| | | | |
| 12 | Previous field | None | Ctrl+P |
| | | | |
-------------------------------------------------------------------
| | | | |
| 13 | Change case | Ctrl+F | Ctrl+F |
| | | | |
-------------------------------------------------------------------
| | | | |
| 14 | Erase character | Backspace | KEY_BACKSPACE or |
| | | | Ctrl+H |
| | | | |
-------------------------------------------------------------------
| | | | |
| 15 | Retype character | Ctrl+Y | Ctrl+R |
| | | | |
-------------------------------------------------------------------
| | | | |
| 16 | Insert character | Ctrl+O | KEY_IC or Ctrl+V |
| | | | |
-------------------------------------------------------------------
| | | | |
| 17 | Delete character | Delete | KEY_DC or Delete |
| | | | |
-------------------------------------------------------------------
| | | | |
| 18 | Restore character | Ctrl+R | Ctrl+U |
| | | | |
-------------------------------------------------------------------
| | | | |
| 19 | Clear to end of | Ctrl+Z | KEY_EOL or |
| | field | | Ctrl+Z |
| | | | |
-------------------------------------------------------------------
| | | | |
| 20 | Clear field | Ctrl+X | KEY_DL or Ctrl+X |
| | | | |
-------------------------------------------------------------------
| | | | |
| 21 | Clear to end of | Ctrl+End | KEY_EOS or |
| | screen | | Ctrl+D |
| | | | |
-------------------------------------------------------------------
| | | | |
| 22 | Clear screen | Ctrl+Home | KEY_CLEAR or |
| | | | Ctrl+E |
| | | | |
-------------------------------------------------------------------
| | | | |
| 23 | Set insert mode | Insert | KEY_IL or Ctrl+T |
| | | | |
-------------------------------------------------------------------
| | | | |
| 24 | Set replace mode | None | Not defined |
| | | | |
-------------------------------------------------------------------
| | | | |
| 25 | Reset field | Ctrl+A | Ctrl+A |
| | | | |
-------------------------------------------------------------------
| | | | |
| 26 | Start of field | None | Ctrl+W |
| | | | |
-------------------------------------------------------------------
| | | | |
| 27 | Move to Mouse | None | Not applicable |
| | position | | |
| | | | |
-------------------------------------------------------------------
NOTE The carriage return (CR) key is referred to here as the Enter key.
On some keyboards, there is a CR key and an Enter key. In this
case, the Adis carriage return key should be set up as CR and the
Adis key "Terminate Accept" should be set up as Enter.
Mapping the Adis Keys to the Functions.
In general, the Adis keys are mapped onto the function of the same name.
Therefore, the [[backspace]] key moves the cursor to the left, the
Backspace key erases a character and so on. However, there are some keys
that are by default mapped onto different functions:
Key Function
-------------------------------------------------------
= Carriage return Terminate ACCEPT operation, function
0
= Tab Move to next field, function 11
= Backtab Move to previous field, function 12
= Set Insert mode Insert Toggle, function 58
Therefore, when you press Enter on your keyboard, it terminates an ACCEPT
operation, because Enter is mapped onto carriage return, and carriage
return causes an ACCEPT operation to be terminated.
At this stage, the idea of mapping keys may seem an unnecessary
complication. Where it becomes really useful is in the emulation of
other dialects of COBOL. For example, in Microsoft COBOL V2.2, the Enter
key moves to the next field rather than terminating an ACCEPT operation.
This is easy to emulate by simply changing the mapping for key 2
(carriage return) from 0 (terminate ACCEPT) to 11 (move to next field).
If you look at the function mappings screen in Adiscf for the Microsoft
COBOL V2.2 compatibility configuration, you can see that this has been
done.
The RM/COBOL V2.0 compatibility configuration contains even more changes
to the default mappings to emulate the action of keys in RM/COBOL.
If a key is mapped on to a value of 255, that key does not perform any
function during an ACCEPT operation.
Special Mappings.
All of the standard functions described above always perform the same
function, regardless of context. For example, the Move to next field
function always attempts to move to the next field. However, there are
some functions that behave differently depending on the context. These
functions are described in the section Special Mapping Functions in
chapter Keyboard Configuration Utility (Keybcf), but are summarized here:
Function Function Name
Number
-------------------------------------------------------
55 RM clear field
56 RM Backspace
57 RM Tab
58 Insert toggle
59 Replace toggle
60 Forward Tab
61 Backward Tab
62 Restore
For example, the Set Insert mode key (key number 23) is normally mapped
to function 58 (Insert toggle). This means that pressing the Insert key
toggles between Insert and Replace mode.
Changing the Mappings from a Program.
As well as changing the mappings through Adiscf, you can do this from an
application program using the following call:
call x"AF" using set-map-byte
adis-key-mapping
where set-map-byte and adis-key-mapping are defined in the
Working-Storage Section of your program as follows:
01 set-map-byte pic 9(2) comp-x value 3.
01 adis-key-mapping.
3 adis-mapping-byte pic 9(2) comp-x.
03 adis-key-number pic 9(2) comp-x.
where:
adis-key-number should be set to the number of the key you wish to
change
adis-mapping-byte should be set to the number of the function you wish
the key to be mapped to
Example.
The following code changes the action of the Backspace key (key number
14) to simply move the cursor to the left (function 3), and changes the
Tab key (key number 8) to perform the Tab function (function 8):
* Change mapping of cursor left key
move 14 to adis-key-number
move 3 to adis-mapping-byte
call x"AF" using set-map-byte
adis-key-mapping
* Change mapping of the tab key
move 8 to adis-key-number
move 8 to adis-mapping-byte
call x"AF" using set-map-byte
adis-key-mapping
Conflict With the x"B0" COBOL System Library Routine.
The x"B0" COBOL system library routine is an alternative method of
defining function keys. It is not supported under UNIX and some other
environments. For further details of this call, see the chapter Library
Routines (Call-by-Number). However, we recommend that you use the method
of detecting function keys defined in this section rather than the x"B0"
routine.
In general, you can use the x"B0" routine to define function keys which
terminate an ACCEPT operation. However, there is one limitation. If you
use x"B0", the carriage return key must be mapped on to the terminate
ACCEPT function. This is the default for this product. If you change
the mapping of carriage return or use a configuration that changes the
mapping (such as Microsoft COBOL V2.2 or IBM COBOL 1.0 compatibility),
then any key set up by the x"B0" call does not terminate the ACCEPT
operation. Instead, it performs the function that carriage return has
been mapped onto.
Enabling and Disabling the Adis Keys.
By default, all of the Adis keys are enabled to perform their defined
functions during an ACCEPT operation. However, it is possible to disable
the keys or make them act as function keys instead. The call to do this
is as follows:
call x"AF" using set-bit-pairs
adis-key-control
where set-bit-pairs and adis-key-control are defined in the
Working-Storage Section of your program as follows:
01 set-bit-pairs pic 9(2) comp-x value 1.
01 adis-key-control.
03 adis-key-setting pic 9(2) comp-x.
03 filler pic x value "2".
03 first-adis-key pic 9(2) comp-x.
03 number-of-adis-keys pic 9(2) comp-x.
where:
adis-key-setting defines the action of the keys affected, as
follows:
0 - The keys are disabled. If the key is
pressed during an ACCEPT operation, the key is
rejected.
1 - The key acts like a function key. If
pressed during an ACCEPT operation, the ACCEPT
operation is terminated.
2 - The key performs its normal action during
an ACCEPT operation. This is the default.
3 - The key performs its normal action unless
it causes the cursor to leave the current
field. If this happens, it behaves like a
function key.
first-adis-key is the number of the first key to be affected.
number-of-adis-keys is the number of consecutive keys to be
affected.
Detection of Adis Keys.
If you have set up an Adis key to act as a function key, it terminates
the ACCEPT operation and key-status is returned with the following
values:
Data Item Setting
-------------------------------------------------------
key-type "2"
key-code-1 Set to the number of the pressed
Adis key. This is the number of the
key not the number of the function
the key has been mapped to.
key-code-2 Undefined.
Example.
The following code sets up Tab and Backtab to act as function keys and
the [[backspace]] and (forward arrow) keys to act as function keys if
they cause the cursor to leave the field.
* Set up Tab (key 8) and Backtab (Key 9) to act as function keys
move 1 to adis-key-setting
move 8 to first-adis-key
move 2 to number-of-adis-keys
call x"AF" using set-bit-pairs
adis-key-control
* Set up cursor-left (key 3) and cursor-right (key 4) to act as
* function keys ONLY if they cause the cursor to leave the field.
move 3 to adis-key-setting
move 3 to first-adis-key
move 2 to number-of-adis-keys
call x"AF" using set-bit-pairs
adis-key-control
accept data-item at 0101
if key-type = "2"
evaluate key-code-1
when 3
display "cursor-left caused the cursor to
- "leave the field"
when 4
display "cursor right caused the cursor to
- "leave the field"
when 8
display "the tab key was pressed"
when 9
display "the back tab key was pressed" end-evaluate
end-if.
Defining a Key in Both the User and Adis Key Lists.
In general, a particular key is defined in either the user key list or
the Adis key list, but not both. However, there is no reason why you
should not define the same key in both lists. In fact, the default
values in the compatibility list (set up for RM/COBOL V2.0 on UNIX
compatibility) include the cursor keys which are also defined in the Adis
key list.
If a key that is defined in both lists is pressed during an ACCEPT
operation, the sequence of actions is as follows:
1. Is the key defined in the user key list?
2. If not, goto 5.
3. Is the user key enabled?
4. If it is, return "1" in key-type and the number of the key in
key-code-1.
5. Is the key defined in the Adis key list?
6. If not, report to the user that the key is undefined.
7. Perform the required action for the Adis key depending on whether
it is disabled, enabled or to act as a function key.
Key Configuration on UNIX.
On some UNIX terminals, you may find that some keys do not function
as expected or do not function at all. This could be due to
inconsistencies between the system terminfodatabase, the absolute
control sequencesgenerated by some keys and the default full screen
ACCEPT/DISPLAY keys in this system (for example, change case of
character).(UNIX)
You should first ensure that the appropriate terminal name is set in the
$TERMenvironment variable and that this gives access to a matching entry
in the system terminfo database. See the appendix Environment Variables.
You should then ensure that all the essential entries are present for the
terminal in the terminfo database and that all the escape sequencesmatch
those generated by the appropriate terminal keys when in raw mode. See
the chapter Device Handling and Terminfo.
Some terminfo files may have been supplied with this system. If so, they
are in $COBDIR/terminfo. The Micro Focus Screen Handling Package,
libscreen, searches for terminfo files in $COBDIR/terminfo before
searching anywhere else.
Solutions to some of the problems you may encounter are listed below:
* The [[backspace]] and Backspace keys produce the same escape
sequence.
* If this happens, the [[backspace]] takes priority over Backspace.
You need to configure an alternate key for Backspace using Keybcf
if you need this function.
* The v and Enter keys produce the same escape sequence.
* If so, the Enter key takes priority over v You need to configure
an alternate key for v using Keybcf if you need this function.
* Animator function keys do not work.
* Some terminfo files may not contain information on function keys.
If this is true, you must configure keys for these functions using
Keybcf. See the chapters Animating and Keyboard Configuration
Utility (Keybcf) for more information.
* If you use Keybcf to configure any key which starts with the
escape character as the first character in its sequence, you
cannot use the Escape key.
* In order to resolve this, configure the Escape function as escape
escape, that is, two escapes. You are then able to use this
function by pressing Escape twice.
* Keybcf creates a single configuration file, cobkeymp, which is
capable of defining the configuration of only a single terminal
type. If you need to define more than one terminal, you can
create multiple cobkeympfiles, and select the desired one on a per
user basis, using the environment variable dd_cobkeympto map to
different configuration files. See the chapter External File
Handling for details on dd_ file-name mapping.
* To add extra terminal initialization sequences when entering COBOL
(for example, to enable user function keys), you should extend
init_1string to include the appropriate sequences. See your
terminal manual for further details on escape sequences.
* If your terminal and terminfo support color and you specify the
REVERSE-VIDEO reserved word, the foreground and background colors
on your screen are swapped. However, your terminfo entry ncv may
prevent this behavior. See the chapter Device Handling and
Terminfo for further details.
Function Keys and COBKEYTIMEOUT.
On network based UNIX systems, information is split into packets, and
thus under certain conditions it is possible for part of a function key
sequence to be split across two packets. This can lead to incorrect key
recognition. This typically occurs while using the telnetor the
rlogincommands.(UNIX)
Your Micro Focus COBOL for UNIX system provides you with the
COBKEYTIMEOUT environment variable, which you can use to determine the
timeout between the arrival of the first key of a function or special key
sequence and the arrival of the next. Setting this environment variable
allows function key sequences to be recognized correctly. See the
appendix Environment Variables for details on setting COBKEYTIMEOUT.
The timeout period, a value in the range 1 to 126, is dependent on the
type of connection and the effective average baud rate. For example,
ethernet connections should not require a value greater than 10. Using
too small a value results in incorrect function and special key
recognition; too large a value results in a delay when certain keys are
pressed (such as Escape) unless they are followed by other keys (such as
Escape).
If the value of the COBKEYTIMEOUT environment variable is outside the
range 1 to 126, null, non-integer or the variable does not exist, then a
direct connection between the terminal and the machine is assumed.
You could also use the COBKEYTIMEOUT environment variable to recognize
function key sequences on terminals which do not send such sequences at
the correct baud rate, but insert pauses between the characters instead.
This environment variable is read once only, when the screen handling
subsystem is initialized. Changing its value after this has no effect.
Data Key Handling.
The data keys are the 256 keys in the extended ASCII character set.
Normally, when you press one of these keys during an ACCEPT operation,
the character is simply put straight into the field. The exception to
this is the keys with ASCII codes in the range 0 to 31, that is, the
control keys. These are generally disabled.
Controlling the Data Keys.
Like most other keys on the keyboard, it is possible to disable data keys
or make them act like function keys, that is, terminate the ACCEPT
operation. To do this, use the following call:
call x"AF" using set-bit-pairs
data-key-control
where set-bit-pairs and data-key-control are defined in the
Working-Storage Section of your programas follows:
01 set-bit-pairs pic 9(2) comp-x value 1.
01 data-key-control.
03 data-key-setting pic 9(2) comp-x.
03 filler pic x value "3".
03 first-data-key pic x.
03 number-of-data-keys pic 9(2) comp-x.
The fields in data-key-control should be set up as follows:
data-key-setting Defines the action of the keys affected, as
follows:
0 - The key is disabled. If it is pressed
during an ACCEPT operation, the bell is rung
and the key rejected.
1 - The key acts as a function key. It
terminates the ACCEPT operation.
2 - The character is simply entered into the
field. This is the default.
first-data-key The first character to be affected.
number-of-data-keys The number of characters to be affected.
Detecting Data Keys Set Up to Act as Function Keys.
If a data key has been set up to act as a function key, it terminates the
ACCEPT operation when pressed, and key-status is set up as follows:
Data Item Setting
-------------------------------------------------------
key-type "3"
key-code-1 Set to the ASCII code of the key
that was pressed.
key-code-2 Undefined.
Example.
* Set up the characters "a" through "z" to terminate the
* ACCEPT operation
move 1 to data-key-setting
move "a" to first-data-key
move 26 to number-of-data-keys
call x"AF" using set-bit-pairs
data-key-control
accept data-item at 0101
if key-type = "3"
evaluate key-code-1
when 65
display "a pressed"
when 66
display "b pressed"
when 90
display "z pressed"
end-evaluate
end-if.
Shift Key Handling.
Adis provides a number of routines to enable an applicaton to make use of
the shift key capabilities of a keyboard. These routines are described
in the following sections.
Most UNIX terminals cannot detect when the Alt or Ctrl keys are pressed
unless they are pressed in conjunction with another valid key. You
should, therefore, avoid using these keys by themselves in portable
applications. Alternatively, the key sequences /a and /c can be used to
simulate the use of Alt and Ctrl keys. See the appendix UNIX Key Usage
Chart for further details.(UNIX)
Determining Available Shift Keys.
This routine enables you to find out which of the shift keys are
detectable as unique events.
Use the following call to determine which shift keys are available to
your program:
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 pic 9(4) comp-x.
where:
adis-function must be 44.
adis-parameter returns which shift keys are available to your
program. The 16 bits in adis-parameter refer to
shift keys as follows, with bit 0 the least
significant:
Bit Associtated Key
4 - 15 Reserved
3 Alt
2 Ctrl
1 Left Shift
0 Right Shift
A value of 1 for any particular bit indicates that the associated key is
uniquely detectable.
Detecting the Current State of the Shift Keys.
This routine enables you to determine which, if any, of the shift keys
are currently pressed.
Use the following call to determine which of the shift keys are currently
pressed:
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 pic 9(4) comp-x.
where:
adis-function must be 46.
adis-parameter returns which of the shift keys are currently
pressed. The 16 bits in adis-parameter refer to
shift keys as follows, with bit 0 the least
significant:
Bit Associated Key
4 - 15 Reserved
3 Alt
2 Ctrl
1 Left Shift
0 Right Shift
A value of 1 for any particular bit indicates that the associated key is
currently pressed.
Enabling or Disabling Shift Keys.
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 must be 1.
shift-key-setting defines 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.
Example.
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.
MPE/iX 5.0 Documentation