[Info-vax] How to detect ^Y from an inner command procedure
Arne Vajhøj
arne at vajhoej.dk
Sat May 20 19:28:09 EDT 2023
On 5/19/2023 1:39 AM, alanfe... at gmail.com wrote:
> On Thursday, May 18, 2023 at 8:41:34 PM UTC-4, Craig A. Berry wrote:
>> On 5/18/23 7:28 PM, Dave Froble wrote:
>>> On 5/18/2023 8:15 PM, alanfe... at gmail.com wrote:
>>>> Suppose you're running a command procedure from a command procedure.
>>>>
>>>> $ TYPE 1.COM
>>>> $ @2.COM
>>>> $ EXIT
>>>>
>>>> $ TYPE 2.COM
>>>> $ WAIT 0:00:04
>>>> $ EXIT
>>>>
>>>> So 1.com runs 2.com.
>>>>
>>>> Suppose you run 1.com and press ^ Y while 2.com is running. The
>>>> command interpreter then exits 2.com and resumes running 1.com. Is
>>>> there any way to tell from 1.com if 2.com was aborted via ^Y or just
>>>> finished normally?
>>>>
>>>> I thought $STATUS might help, but sometimes I get
>>>> $STATUS == "%X10000001"
>>>> and sometimes I get
>>>> $STATUS == "%X10010001"
>>>> So I guess that's not the way to go.
>>>
>>> I would start with "on error ..."
>>>
>> You might benefit from the following in 2.com:
>>
>> $ On Control_Y Then Goto Control_Y_exit
>> . . .
>> $ Control_Y_exit:
>> $ $status = 1552 ! %SYSTEM-W-CONTROLY
>
> Sorry, I forgot one very important thing. I am writing a DCL command
> procedure that will run _others'_ procedures, but on multiple files.
> So I have no control over the user's file, save to copy it and add
> statements top and bottom.
I think that is the way to go.
$ typ z1.com
$ ! doing something out of our control
$ write sys$output "Z1 started"
$ wait 00:00:15
$ write sys$output "Z1 done"
$ exit
$ typ z2.com
$ ! doing something out of our control
$ write sys$output "Z2 started"
$ wait 00:00:15
$ write sys$output "Z2 done"
$ exit
$ typ z.com
$ on control_y then continue
$ call wrap_and_run "z1"
$ call wrap_and_run "z2"
$ exit
$ wrap_and_run: subroutine
$ magic = 1111
$ tmpfnm = f$unique()
$ open/write f 'tmpfnm'.com
$ write f "$ on control_y then exit ''magic'"
$ copy 'p1'.com f
$ close f
$ @'tmpfnm'
$ if $status .eq. magic then write sys$output "CTRL/Y in ''p1'"
$ del 'tmpfnm'.com;*
$ return
$ endsubroutine
$ @z
Z1 started
Interrupt
CTRL/Y in z1
Z2 started
Interrupt
CTRL/Y in z2
Arne
More information about the Info-vax
mailing list