Awhile back, I was asked if it were possible to determine when the RUNQRY command had been canceled with F3 or F12. I had no answer, but Tom Liotta of PowerTech Group (www.400security.com) did, and he shared it with me. Tom uses the QUSRJOBI API to test for these keys. Pressing F3 or F12 places a character 1 in byte 103 or 104, respectively.
Following is Tom's code, which I have modified slightly. First, I shortened the lines that were too long for the purposes of this tip. Second, I added the return commands to the do groups. Third, I added the outtype(*PRINTER) parameter to the RUNQRY command. That's not necessary, but trapping a cancel request probably makes more sense when output is to be sent to a printer, since outtype(*DISPLAY) causes RUNQRY to be prompted over and over until it is canceled.
Tom had separate tests for F3 and F12. If you don't care which key the operator pressed, you might want to combine the two do groups into one. Tom adds, "This code can be used in many cases for functions that do not send messages when cancelled. I believe this is standard for UIM [User Interface Manager]-based functions." Thanks for sharing this useful technique with your fellow readers, Tom!
dcl &a_len *char 4 /* Bin Data/Entry length */ dcl &a_rcv *char 1000 /* Receiver Variable, the */ /* length is variable. It */ /* must be in &A_LEN. */
/* ---------------------------------------------------*/ /* RUNQRY was not canceled */ /* ---------------------------------------------------*/
Ted Holt is an IT consultant living in northeast Mississippi. He welcomes your comments at This email address is being protected from spambots. You need JavaScript enabled to view it..
Do you have a tip to share?
The useful techniques you discovered or created to help you do your job are exactly the techniques others are looking for! Share with your peers! Send your tips to This email address is being protected from spambots. You need JavaScript enabled to view it..
LATEST COMMENTS
MC Press Online