CompuServe Messages

#Finding Process Number?

    29-Nov-93 00:11:30
Fm: John Draper 76703,4322
To: Terry Carroll 71550,133
Ahh! That's a horse of a different cruller, as we used to say around the donut shop. I use WShell, as I mentioned, so I can use the following to show where the Arexx program was launched from.. say address() which results in the string 'WSH_3' (or whichever WShell it launched from). I just tried it with AmigaShell, however, and all it said was 'REXX'. I think I have a solutin to your problem, though. You could write a little routine into any program you want to interrupt that would look for a message at a message port, and end the program (as gracefully as you want) if the message arrives. Here are a couple programs to show you what I mean. The first is an example of the code to add to your program in a convenient place… /* test.rexx – test message port actions */ call openport("testport") do forever packet = getpkt('testport') if packet ~= '00000000'x then do pktstring = getarg(packet) if pktstring = 'kill' then do say "OK, I'm outta here." call reply(packet,0) leave end else call reply(packet,0) end call delay(50) say 'still going' end And here is the program to kill the first one… /* killit.rexx – send packet to test.rexx */ say 'sending message to test.rexx' address 'testport' 'kill' To tes these, run the first one from one CLI, and the second from another. When the second one is run, the first one will print a message and exit. You will need to have rexxsupport.library loaded in order for the getpkt() and getarg() functions to work. If you decide to use this, you should probably put the minimum amount of code inline, and call a function or procedure to implement the check of the argument and the shutdown. Additionally, you could use the killit.rexx program in a more generic way by allowing for and parsing an argument, so that you could use syntax of the form: killit longsearch killit otherprogram And even more generically, by allowing more arguments, and letting the user specify both the target progam and the 'message' to be sent… tellrexx longsearch kill tellrexx cleanup pause tellrexx cleanup resume Hope this helps. -larry