×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hi Tim,
I would like to be able to stop the search by hitting a key (say esc
key tied to an attention program).
The only way that I know of is to run the SQL search in a separate job
(a background job) where you can get the user's input (via an INVITEd
screen, etc) and end the background job if the user presses the abort key.
(Personally, I'd use something like F12=Cancel or a different F-key
rather than trying to use ESC, which isn't a key on the 5250 keyboard.
ATTN would work, but people like to be able to map that to a program or
utility that they want to open in the middle of another application. So
I'd just use an F-key of some sort.
I'd use data queues to communicate with the background job, since both
the display file is also able to add records to a data queue when the
user presses a key. That way, your code has only one object to wait on,
the data queue. Depending on the type of record, you'll know whether
input came from the display or the SQL search.
If the user wants to cancel, you just issue an ENDJOB statement against
the background job. If for some reason, the job is in a state where it
can't be cancelled (such as the middle of building a temporary index)
the job will keep running until it's able to end, and then finally end.
Your program need not wait for it to do that, so your user can happily
go about his/her business.
The only other possibility I can think of is signals. I've never tried
using a signal to abort an SQL statement, and I don't know if it's
possible... but I've used it to abort other things (sockets, displays,
interative CL commands, etc.) and it has worked. If signals work with
an SQL statement, they might let you do this all in one job. The
problem is, if this isn't documented anywhere by IBM, who knows if it'll
work today and not tomorrow? Or if it won't even work today... or if
it'll mess something up... hard to say. But it's interesting to
consider as an intellectual exercise.
As an Amazon Associate we earn from qualifying purchases.