Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

CTRL/C signal command

Occasional Contributor

CTRL/C signal command

I want to run a batch that requires CTRL/C ternminate action.
For example i want to automate the memory check process and i need to use CTRL/C.


Here what command should i use for CTRL/C ?

Steven Schweda
Honored Contributor

Re: CTRL/C signal command

> Here what command should i use for CTRL/C ?

I know of no way to do a real CTRL/C there.

alp $ smm
%DCL-W-IVVERB, unrecognized command verb - check validity and spelling

I don't know what "smm" means to you.
Whatever it is, in a batch job, it may work
differently from the way it works with a
terminal for SYS$COMMAND. Have you tried it?
Honored Contributor

Re: CTRL/C signal command

Batch processes do not have terminals, and it is data input from a terminal or from a pseudo-terminal that is fielded by the terminal driver, and it is the terminal driver then passes along the command to DCL to process the ^C or ^Y input.

Here, you can fix the code to exit properly (which would generally be the better approach here), or you can send a STOP/ID /EXIT at the batch process from a controlling application or job scheduler, and these will work from batch.

The most direct analog to your request would be to run the application via pseudo terminal and send the ^C under application control; the pseudo-terminal allows an application-controlling program to control another; the second operates as if it had a terminal, but its input and output are processed by the controlling application. This is not available in batch; you'd need to use what amounts to a detached process with a terminal here, not a batch process. (Again, batch processes don't have terminals.)

And yes, you could configure some wiring and a real terminal, and connect the application and the controlling application that way; pseudo-terminals eliminate the cabling. That still doesn't get you access into the context of the batch job, though.

If your goal is to activate a specific ^C or ^Y handler within the image executing within the batch process, that's (barring pseudo-terminals) not directly available AFAIK. STOP will send an exit but won't typically activate any ^C handlers or such that might be present within the application.

The best approach (and presuming you have the source code available) is to implement a different exit path within the image (eg: an exit command), or to implement some form of interprocess communications here (anything from simple to complex) to notify the batch process it should exit.