CANCEL
Stops a job. Add PURGE to remove its output too.
Why it matters. A job that runs too long can hold up other work. CANCEL stops it before it does harm.
Syntax
CANCEL jobname[(jobid)] [PURGE | NOPURGE] CANCEL (jobname[(jobid)] jobname[(jobid)] ...)
- jobname
- The job to stop. The name must start with your user ID, unless your installation changed that.
- (jobid)
- The job number in brackets. It picks one job when two share a name.
- PURGE
- Also remove the job and its output from the system.
- NOPURGE
- Stop the job but keep its output. This is the default.
- (job1 job2)
- A list of jobs in brackets, to stop several at once.
Try it CANCEL
- 1
Your job ZB0001A is still running. Stop it.
CANCEL ZB0001A - 2
Clear the stopped job's output from the spool too.
CANCEL ZB0001A PURGE
Remember
- CANCEL stops a job. PURGE removes its output.
- In MF/OS, a job that has already finished is purged, not stopped.
- You can only cancel your own jobs.
The usual mistake
CANCEL
CANCEL on its own does not name a job. Real TSO asks you for the job name. MF/OS says it found no such job.
CANCEL ZB0001A
On real z/OS
Real CANCEL is quiet: you get READY, and the operator console gets a message. In MF/OS the word PURGE is read but not used. Cancelling a job that is running stops it and keeps its output, and cancelling a job that has already finished purges it. The $HASP lines are JES2 messages that a real system sends to the job log and console, not to your terminal.
Where can I practise CANCEL?
Right here, at ZedBank. You take a junior job at a simulated bank and use CANCEL in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- JobA unit of batch work submitted to the system, made up of one or more steps that run in order.
- JES2The job entry subsystem: the part of z/OS that queues jobs, decides when they run, and collects their output.
- SpoolThe system-managed holding area where job output waits to be read, printed or purged.
- AbendAn abnormal end: a program stopping in an uncontrolled way rather than finishing and reporting a result.
- Return codeA number a program leaves behind saying how it went. Zero for clean, higher numbers for warnings and failures.
- Job classA single-character label on a job that tells the system what kind of work it is and how to schedule it.