Command reference / job

ENDJOB

End Job

Ends the specified job and any associated inline data files. The job can be on a job queue, active, or already completed. The application can be given time for controlled end-of-job processing. If no time is given, or cleanup cannot finish in time, minimal end-of-job processing runs: closing database files, spooling the job log, cleaning up internal objects, showing the end-of-job display for interactive jobs, and completing commitment control processing. Before ending a job, verify that no logical unit of work is in doubt from a two-phase commit, because the Action if ENDJOB commitment option (default WAIT) can hold the job until that operation completes.

Allowed environments: *ALL. Positional parameters: 4.

Restrictions

Parameters

JOB Job name

Specifies the qualified job name of the job to be ended. This is a required parameter.

Type
*QUAL
Required
Yes
Case
Uppercase

Suggested / special values: *

*
The job from which this command is run is ended. This is the only way to end the current job.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Job name Job name

Type
*NAME
Required
No
Length
10
Case
Uppercase

User User

Type
*NAME
Required
No
Length
10
Case
Uppercase

Number Number

Type
*CHAR
Required
No
Length
6
Case
Uppercase

OPTION How to end

Specifies whether the job ends immediately or in a controlled manner that lets the application program perform end-of-job processing. In either case, the system performs some job cleanup.

Type
*CHAR
Required
No
Default
*CNTRLD
Length
7
Case
Uppercase

Allowed values: *CNTRLD, *IMMED

*CNTRLD
The job ends in a controlled manner, so the program can perform cleanup within the DELAY time.
*IMMED
The job ends immediately with system end-of-job cleanup. The program cannot clean up, apart from handling SIGTERM. Can cause undesirable results if data is partially updated.

DELAY Controlled end delay time

Type
*INT4
Required
No
Default
30
Range
1 to 999999
Case
Uppercase

SPLFILE Delete spooled files

Specifies whether spooled output files created by this job are kept for normal processing or deleted. Job logs are kept either way.

Type
*CHAR
Required
No
Default
*NO
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*NO
Spooled output files are kept for normal processing by a writer.
*YES
Spooled output files created by the job and on output queues in the library name space of the issuing thread are deleted. The job log is not deleted.

LOGLMT Maximum log entries

Specifies the maximum number of entries in the message queue of the job being ended that are written to the job log. Can limit messages written to the QPJOBLOG printer file.

Type
*INT4
Required
No
Default
*SAME
Case
Uppercase

Suggested / special values: *SAME, *NOMAX

*SAME
The message logging limit does not change.
*NOMAX
There is no limit. All messages on the job message queue are written to the job log.

ADLINTJOBS Additional interactive jobs

Specifies whether the additional interactive jobs associated with the job named in the JOB parameter are ended.

Type
*CHAR
Required
No
Default
*NONE
Length
7
Case
Uppercase

Allowed values: *NONE, *GRPJOB, *ALL

*NONE
Only the job specified in the JOB parameter is ended.
*GRPJOB
If the job is a group job, all group jobs associated with the group are ended. If not, only the specified job is ended.
*ALL
All interactive jobs running on the workstation associated with the job are ended, including group and secondary jobs.

DUPJOBOPT Duplicate job option

Specifies the action taken when duplicate jobs are found by this command.

Type
*CHAR
Required
No
Default
*SELECT
Length
7
Case
Uppercase

Allowed values: *SELECT, *MSG

*SELECT
The selection display is shown when duplicate jobs are found in an interactive session. Otherwise a message is issued.
*MSG
A message is issued when duplicate jobs are found.

Examples

ENDJOB JOB(JOB1) OPTION(*IMMED) SPLFILE(*YES)

Ends job JOB1 immediately. Spooled output produced by the job is deleted; the job log is saved.

ENDJOB JOB(001234/XYZ/JOB2) OPTION(*CNTRLD) DELAY(50) SPLFILE(*NO)

Ends job 001234/XYZ/JOB2. Spooled output is saved for normal processing by the spooling writer. The job has 50 seconds for cleanup, after which it is ended immediately.

IBM command documentation

Generated from os/cl/catalog/ENDJOB.json and os/cl/help/ENDJOB.json.