Endjobs  
by Giovanni B. Perotti
Some powerful commands for IBM System i
Prerequisites
  • At least OS/400 release V5R3
  • 57xxWDS option 31 - Compiler ILE RPG IV
  • 57xxDG1 - IBM HTTP Server for iSeries
   1- Command ENDJOBS

Command ENDJOBS allows to end immediately in a single shot all the jobs matching the criteria specified in command parameters:
  1. Subsystem: the name of the subsystem where are the jobs eligible to be ended, example: SUBSYSTEM(QINTER). Use *ALL to specify all subsystems.
  2. Job name: the name of the jobs eligible to be ended. Generic name supported, example: JOB(QPADEV*). Use *ALL to specify all job names.
  3. Job user: the name of the user profile running the jobs eligible to be ended. Use *CURRENT to specify the name of the user profile running this command. Use *ALL to specify all user profiles.
  4. Job number: enter a job number if you want to end just that job, otherwise use *ALL.
  5. Job status: type the status code of the jobs eligible to be ended or *ALL to accept any job status code. The available job status codes are:
    BSCA BSCW CMNA CMNW CMTW CNDW CPCW DEQA DEQW DKTA DKTW DLYW DSC DSPA DSPW END EOFA EOFW EOJ EVTW GRP HLD HLDT ICFA ICFW INEL JVAA JVAW LCKW LSPA LSPW MLTA MLTW MSGW MTXW MXDW OPTA OPTW OSIW PRTA PRTW PSRW RUN SELW SEMW SIGS SIGW SRQ SVFA SVFW TAPA TAPW THDW TIMW .
  • Parameter (Log ended jobs) allows to log to database file ENDJOBSDTA/ENDEDJOBS all the jobs ended by this command. A log entry documents:
    • the timestamp of the event
    • the job which performed the ENDJOB
    • the job that was ended
    • the status of the ended job
    • the running function - if available - of the running job.
  • Parameter (Display the log of ended jobs) allows to display the log entries created from the current job.

To ease command repetitions, command ENDJOBS is provided with a prompt override program which retrieves the parameter values used in the previous command by the same user profile.

In order to prevent possible damages, command ENDJOBS

  • sends an escape message when all parameters specify value *ALL
  • never ends the following jobs:
    • the job running the command ENDJOBS
    • jobs displaying QSYS as job user or current user
    • (optional) jobs with jobname starting by letter Q, unless they are in subsystem QBASE or QINTER.

Note 1. Command DSPENDJOBS allows to list the jobs ended by command ENDJOBS.

  2- Command MNGOBJLCK

Command MNGOBJLCK (Manage Object Locks) is very similar to system command WRKOBJLCK (Work with Object Locks) inasmuch it
  • displays a list of the jobs allocating a given object and provides options to
    • work with jobs
    • work with job locks
    • end jobs
However command MNGOBJLCK has some different behaviors
  • It allows to work only with jobs not belonging to a list of "protected user profiles".
    Protected user profiles are documented in physical file ENDJOBSDTA/USRPRFOUT. This file contains Q... system user profiles. You may add your own, or remove existing ones.
  • Jobs are not ended in controlled mode as in command WRKOBJLCK, they are ended in immediate mode. This saves you some time.
  • Command F10 allows to enter Command Entry Screen, so that you can perform some other checks that you may need.
  • Command F23 ends all the listed jobs which are not run by protected user profiles.
  3- Command MNGIFSLCK

Command MNGIFSLCK (Manage IFS Object Locks) deals with IFS objects. It
  • displays a list of the jobs referencing a given IFS object and provides options to
    • work with jobs
    • end jobs
  4- Command CHKACTJOB

Command CHKACTJOB (Check Active Jobs), at given time intervals, scans the system for active jobs. For each job it retrieves some general information (such as IP address used, job type, job status, job description, ASP data, etc.) and some performance information (number of interactive transactions, average interactive response time, processing units used, number of I/O operations, etc.) and optionally calls a user-specified program passing this information. The user-program may then take actions depending on this job information. As an example, the user-progtram could end an interactive job if it had no transactions in the last 30 minutes.
The information passed to the user program is mapped by a copy statement:
/copy endjobs,qrpglesrc,jobinf1400 .
An example of user program (called from command CKHACTJOB) is provided in
ENDJOBS/QRPGLESRC member ENDIDLEJOB .
  Prerequisites
  • System library QRPGLE (Product number 57xxWDS option 31 - Compiler - ILE RPG IV)
  • Minimum OS/400 Release V5R3.
Once installed, library ENDJOBS can be saved and restore on another system not having system library QRPGLE. However, it is necessary to run command ENDJOBS/INSTALL to create and populate library ENDJOBSDTA, containing local data.
   Download
To download this utility, just press the "Download now" button.
Registration required.
download now
  Installation
  • unzip PC file endjobs.zip
  • transmit (binary) PC file endjobs.sav
    to IBM System i save file qgpl/endjobs
  • rstlib savlib(endjobs) dev(*savf) savf(qgpl/endjobs)
  • strrexprc srcmbr(install) srcfile(endjobs/qrexsrc)
  Updates
  • To know about the available ENDJOBS releases, press this link .
  • To know the release date of the ENDJOBS package you have installed on your IBM i, run command ENDJOBS/RELEASED .
 
contact us contact us