The CRT STATUS clause of the SPECIAL-NAMES paragraph provides a data item composed as follows:
The following examples show how the CRT status key should be coded and referenced.
************************************************************
* *
* The following shows how the special-names paragraph *
* sets up both a cursor position field and a CRT status *
* key field. *
* *
************************************************************
special names.
cursor is cursor-position
crt status is crt-status.
...
working-storage section.
01 cursor-position pic 9(4).
************************************************************
* The following group item defines the CRT status key *
* field and establishes certain 78-level condition-names *
* associated with key fields. *
* *
* Programs using these definitions should be compiled *
* with NOIBMCOMP and MF to function as expected. *
* *
************************************************************
01 crt-status.
05 crt-status-1 pic 9.
88 terminate-key value 0.
88 function-key value 1.
88 adis-key value 2.
88 status-1-error value 9.
05 crt-status-2 pic 99 comp-x.
88 esc-key value 0.
88 f1-key value 1.
88 enter-key value 1.
88 fun-key-num-user values 0 thru 127.
88 fun-key-num-system values 0 thru 26.
05 crt-status-3 pic 99 comp-x.
88 raw-key-code values 0 thru 255.
...
procedure-division.
...
************************************************************
* *
* The following shows the procedural code that would *
* evaluate the CRT status keys and direct processing *
* accordingly. *
* *
************************************************************
evaluate terminate-key also function-key also adis-key
when true also any also any
if esc-key
evaluate crt-status-3
when 0 perform raw-key-0
when 1 perform raw-key-1
when 2 perform raw-key-2
when 3 perform raw-key-3
...
end-evaluate
else
perform logic-for-terminator-key
end-if
when any also true also any
evaluate crt-status-2
when 1 perform user-function-1
when 2 perform user-function-2
when 3 perform user-function-3
when 4 perform user-function-4
when 5 perform user-function-5
...
end-evaluate
when any also any also true
evaluate crt-status-2
when 1 perform sys-function-1
when 2 perform sys-function-2
when 3 perform sys-function-3
when 4 perform sys-function-4
when 5 perform sys-function-5
...
end-evaluate
end-evaluate