If you decide that you want your application to use function keys, it is highly likely that you will want to be able to determine exactly which key has been pressed. To do this you need to include the CRT STATUS clause in the Special-Names paragraph of your program as follows:
special-names.
crt status is key-status.
where:
01 key-status.
03 key-type pic x.
03 key-code-1 pic 9(2) comp-x.
03 key-code-2 pic 9(2) comp-x.
Whenever an ACCEPT statement is executed, key-status is set to indicate how the ACCEPT was terminated. The exact usage of the individual fields in key-status is described later. However, in general they have the following uses:
These different values are described fully later in this section.
If key-type is 4, key-code-2 contains the second byte of the character which caused the ACCEPT operation to terminate.
Otherwise, the contents of key-code-2 are undefined.