IBM i Job Commands Reference

IBM i job commands let you inspect active work, open a single job, and read its job log. They also control whether a job continues running. Use this page when the problem is clearly work management. It helps you choose the right command before you change a job.

Inspection commands are safe starting points. Commands such as ENDJOB, HLDJOB and RLSJOB change processing and should follow your site’s operating procedure.

Quick command map

TaskCommandRead-only?
Show all active jobsWRKACTJOBDisplay is read-only; options can change jobs
Work with one jobWRKJOBDisplay is read-only; options can change the job
Display one jobDSPJOBUsually read-only
Display the active job logDSPJOBLOGRead-only
End a jobENDJOBNo
Hold a jobHLDJOBNo
Release a held jobRLSJOBNo

Qualified job names

Most commands can identify a job as:

123456/USER/JOBNAME

The three parts are job number, user and job name. Use all three when there can be duplicates. If you know only the name, a work-with display may ask you to select the exact job.

WRKACTJOB

WRKACTJOB is the first screen for active work. It shows jobs by subsystem, status, CPU use, elapsed activity and function.

WRKACTJOB
WRKACTJOB SBS(QBATCH)

Use it to find:

  • A job in MSGW
  • A batch job using high CPU
  • A job stuck in a subsystem
  • A job name and number before opening it with WRKJOB

The display itself is inspection. Options from the display can hold, release, end, change or work with a job. Do not treat every option on the screen as read-only.

WRKJOB

WRKJOB opens a menu for one job. IBM documents options for job status attributes, definition attributes, run attributes, spooled files, job log, call stack, locks, library list, open files, file overrides, commitment control, communications, activation groups, threads and environment variables.

WRKJOB JOB(123456/USER/JOBNAME)
WRKJOB JOB(123456/USER/JOBNAME) OPTION(*JOBLOG)
WRKJOB JOB(123456/USER/JOBNAME) OPTION(*SPLF)
WRKJOB JOB(123456/USER/JOBNAME) OPTION(*PGMSTK)
WRKJOB JOB(123456/USER/JOBNAME) OPTION(*LIBL)

Useful options include:

OptionUse it for
*JOBLOGMessages for the job
*SPLFSpooled files created by the job
*PGMSTKCall stack
*JOBLCKObject locks
*LIBLLibrary list used by the job
*OPNFOpen files
*CMTCTLCommitment control status
*ACTGRPActivation groups
*THREADThread information

Some options are available only when the job is active. Environment variables for another user’s job can require service special authority.

DSPJOB

DSPJOB displays job information and can be more direct than the work-with menu when you know which view you need.

DSPJOB JOB(123456/USER/JOBNAME) OPTION(*JOBLOG)
DSPJOB JOB(123456/USER/JOBNAME) OPTION(*SPLF)
DSPJOB JOB(123456/USER/JOBNAME) OPTION(*LIBL)

Use DSPJOB for inspection and WRKJOB when you need an interactive menu of choices.

DSPJOBLOG

DSPJOBLOG displays the job log for a job that is active or whose job log has not yet been written as a spooled file.

DSPJOBLOG
DSPJOBLOG JOB(123456/USER/JOBNAME)
DSPJOBLOG JOB(123456/USER/JOBNAME) OUTPUT(*PRINT)

For a job that has ended, the log may be in the job’s spooled files as QPJOBLOG. Use WRKJOB OPTION(*SPLF) or WRKSPLF to find it. The IBM i Job Log and CPF Messages Reference explains how to read the messages.

ENDJOB

ENDJOB asks IBM i to end a job. It is an operational command, not a diagnostic command.

ENDJOB JOB(123456/USER/JOBNAME) OPTION(*CNTRLD) DELAY(60)
ENDJOB JOB(123456/USER/JOBNAME) OPTION(*IMMED)

Use a controlled end when possible. OPTION(*IMMED) is a stronger action and can leave work incomplete. Before ending a job, capture the symptom: status, job log, current function, call stack and locks.

HLDJOB and RLSJOB

HLDJOB makes a job ineligible for processing. RLSJOB makes a held job eligible again.

HLDJOB JOB(123456/USER/JOBNAME)
RLSJOB JOB(123456/USER/JOBNAME)

Holding a job is usually useful for submitted batch jobs that have not started, or for controlling work while an operator investigates. It is not the same as ending a running job.

MSGW triage

When WRKACTJOB shows MSGW, the job is waiting for a message reply.

  1. Open the job with WRKJOB.
  2. Display the job log.
  3. Find the inquiry message.
  4. Read the message help and earlier diagnostic messages.
  5. Reply only when the correct answer is known.

Use Troubleshooting an IBM i Job Stuck in MSGW for the full runbook.

Common mistakes

  • Ending a job before saving the job log evidence.
  • Looking at the current interactive job instead of the qualified batch job.
  • Assuming WRKACTJOB status alone explains the root cause.
  • Replying to an inquiry message from memory instead of reading the message help.
  • Using OPTION(*IMMED) as the normal first response.
  • Forgetting that work-with displays can perform changes from options.

Read-only inspection checklist

Before changing a job, capture the details that will disappear or change after the action:

DetailCommand path
Current status and functionWRKACTJOB, then note the function column
Full job identityWRKACTJOB or WRKJOB
MessagesWRKJOB OPTION(*JOBLOG) or DSPJOBLOG
Program stackWRKJOB OPTION(*PGMSTK)
Spooled filesWRKJOB OPTION(*SPLF)
LocksWRKJOB OPTION(*JOBLCK)
Library listWRKJOB OPTION(*LIBL)

This checklist is especially useful before ENDJOB, because the end action can change the evidence. If a job is waiting for a reply, use the IBM i MSGW troubleshooting runbook before answering or ending it.

FAQ

Is WRKACTJOB read-only?

The initial display is inspection. Options from the display can change jobs, so treat any option that holds, releases, changes or ends work as an operational action.

When should I use WRKJOB instead of DSPJOB?

Use WRKJOB when you want the menu for one job. Use DSPJOB when you already know the exact information view you want to display or print.

Can ENDJOB be undone?

No. You can restart the business process if the application supports that, but the ended job itself is gone. Capture the job log and current state first.

What should I record in an incident ticket?

Record the qualified job name, subsystem, status, current function, message ID, job log timing and the action taken. Those details let another operator reproduce the investigation later.

Summary

  • Use WRKACTJOB to find active work and status.
  • Use WRKJOB or DSPJOB to inspect one job.
  • Use DSPJOBLOG and WRKJOB OPTION(*JOBLOG) for messages.
  • Use ENDJOB, HLDJOB and RLSJOB only as deliberate operational actions.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top