Chapter 1 - The JOBWATCHCF Command
The JOBWATCH command consists of the following options:
Job Status Maintenance (main screen)
Job Maintenance (F6)
MSGQ Maintenance (F7)
8/25/04 Job Watch (JOBWATCH) TS400
08:45:56 Job Status Maintenance BVSTONE
Type options, press Enter.
1=Add 2=Work with Command 3=Copy 4=Delete 5=Activate/Deactivate
Opt Status Command
_ ____ ________________________________________________________________
_ *C50 SNDMSG MSG('Job &J User &U Job Number &N has a CPU% of over 5...
_ MSGW MAILTOOL TOADDR(address@domain.com) FROMADDR(sysop@domain.com...
_ MSGW SNDDST TYPE(*LMSG) TOINTNET((address@domain.com)) DSTD('Job &...
Bottom
F3=Exit F4=Prompt F5=Refresh F6=Job Maintenance F7=MSGQ Maint
The JOBWATCHCF command allows you to view and work with commands that are set up on your system. Active commands are shown in yellow, and inactive commands are shown in green.
Job Maintenance
Pressing F6 from this screen will bring you to the Job Watch Job Maintenance Screen.
10/21/08 Job Watch (JOBWATCH) S1012CBA
14:20:06 Job Maintenance BVSTONE
Type options, press Enter.
1=Add 2=Work with Command 3=Copy 4=Delete 5=Activate/Deactivate
Opt Status Job Name Min Command
_ _______ __________ _____ _________________________________________________
_ *ACTIVE TESTING 10 MAILTOOL TOADDR(bvstone@bvstools.com) FROMADDR...
Bottom
F3=Exit F4=Prompt F5=Refresh
Enter a status, job name, and the minimum number of jobs you want to check that are active. The command entered for this entry will be run only if the total number of jobs that match the status is less than the minimum number of jobs specified on this entry.
With v3.01 SP111006 and up you have the ability to use wildcards for the job name. In this case, the minimum jobs will be counted against the total jobs found that match the wildcard.
With v3.10 and up, when the status is *MINACT you are telling the system to check the total minutes the job has been active against the value in the MIN column (which would be the maximum minutes before the command associated is run). If the job has been running longer than the specified time the command will be run.
MSGQ Maintenance
Pressing F7 from this screen will bring you to the Job Watch MSGQ Maintenance Screen.
9/10/19 Job Watch (JOBWATCH) S216709W
09:16:15 MSGQ Maintenance BVSTONE
Type options, press Enter.
1=Add 2=Work with Details 3=Copy 4=Delete 5=Activate/Deactivate
Opt MsgQ Name Msg Type Mn Sev Command
_ __________ *ALL 0 ____________________________________________________________________
_ QSYSOPR *ALL 50 MAILTOOL TOADDR(bvstone@bvstools.com) SUBJ...
Enter a status, job name, and the minimum number of jobs you want to check that are active. The command entered for this entry will be run only if the total number of jobs that match the status is less than the minimum number of jobs specified on this entry.
With v3.01 SP111006 and up you have the ability to use wildcards for the job name. In this case, the minimum jobs will be counted against the total jobs found that match the wildcard.
With v3.10 and up, when the status is *MINACT you are telling the system to check the total minutes the job has been active against the value in the MIN column (which would be the maximum minutes before the command associated is run).
The following options are availble for both screens:
1=Add - To add a new entry, enter option 1 on the first line. Then enter a status, and a command. Entering a + on the command will bring you to an extended command entry display.A list of status codes are at the bottom of this page.
2=Work With Command - This option will allow you to work with the command for a specific entry.
3=Copy - This option will allow you to copy an entry that already exists.
4=Delete - This option will delete an entry from the list. If you aren't sure if you should delete an entry, instead choose the activate/deactivate option to deactivate a particular entry
5=Activate/Deactivate - This option is used to turn on or off a particular option. Active entries are listed in yellow. Inactive entries are listed in green.
Working With Commands
Enter Extended Command
Status . . . MSGW
Enter extended Command:
MAILTOOL TOADDR(address@domain.com) FROMADDR(sysop@domain.com) SUBJECT('Job &J
in &S Status at &M') MESSAGE('The following job in is &S status:\n\nNSystem: &M\
nJob: &J\nUser: &U\nJob Number: &N\nSubsystem: &L/&Y\nFunction: &F\nJob Type: &T
\nJob Subtype: &B') SENDWITH(*MAILTOOL)_________________________________________
____________________________________________________...
Trim: *YES
F4=Prompt F12=Cancel
Option 2 allows you to work with a current command for an entry. On this screen you can enter and edit commands. F4 will allow you to prompt on the command.
All command options now have a TRIM option that will tell the JOBWATCH program to either TRIM the replacement variable data or not. Specify *YES when using a command or *NO when calling a program and the replacement variables are used as parameters.
On the MSGQ Maintenance screen there is also a timestamp field that should be initially set to know what date/time to start looking for messages. Any time a match is found for a MSGQ entry the timestamp will be automatically updated to the latest message timestamp so messages will not be repeated.
Available Status Codes
When setting up a new entry in the Job Status Maintenance Screen, the following status codes are availble for use:
BSCA Waiting in a pool activity level for the completion of an I/O operation to a binary synchronous device.
BSCW Waiting for the completion of an I/O operation to a binary synchronous device.
CMNA Waiting in a pool activity level for the completion of an I/O operation to a communications device.
CMNW Waiting for the completion of an I/O operation to a communications device.
CMTW Waiting for the completion of save-while-active checkpoint processing in another job.
CNDW Waiting on handle-based condition.
CPCW Jobs waiting for the completion of a CPI Communications call.
DEQA Waiting in the pool activity level for completion of a dequeue operation.
DEQW Waiting for completion of a dequeue operation. For example, QSYSARB and subsystem monitors generally wait for work by waiting for a dequeue operation.
DKTA Waiting in a pool activity level for the completion of an I/O operation to a diskette unit.
DKTW Waiting for the completion of an I/O operation to a diskette unit.
DLYW The Delay Job (DLYJOB) command delays the job for a time interval to end, or for a specific delay end time. The function field shows either the number of seconds the job is to delay (999999), or the specific time when the job is to resume running.
DSC Disconnected from a work station display.
DSPA Waiting in a pool activity level for input from a work station display.
DSPW Waiting for input from a work station display.
END The job has been ended with the *IMMED option, or its delay time has ended with the *CNTRLD option.
EOFA Waiting in the activity level to try a read operation again on a database file after the end-of-file has been reached.
EOFW Waiting to try a read operation again on a database file after the end-of-file has been reached.
EOJ Ending for a reason other than running the End Job (ENDJOB) or End Subsystem (ENDSBS) command, such as SIGNOFF, End Group Job (ENDGRPJOB), or an exception that is not handled.
EVTW Waiting for an event. For example, QLUS and SCPF generally wait for work by waiting for an event.
GRP Suspended by a Transfer Group Job (TFRGRPJOB) command.
HLD Held.
HLDT Held due to suspended thread.
ICFA Waiting in a pool activity level for the completion of an I/O operation to an intersystem communications function file.
ICFW Waiting for the completion of an I/O operation to an intersystem communications function file.
INEL Ineligible and not currently in the pool activity level.
JVAA Waiting in a pool activity level for a Java program operation to complete.
JVAW Waiting for a Java program operation to complete.
LCKW Waiting for a lock.
LSPA Waiting in a pool activity level for a lock space to be attached.
LSPW Waiting for a lock space to be attached.
MLTA Waiting in a pool activity level for the completion of an I/O operation to multiple files.
MLTW Waiting for the completion of an I/O operation to multiple files.
MSGW Waiting for a message from a message queue.
MTXW Waiting for a mutex. A mutex is a synchronization function that is used to allow multiple jobs or threads to serialize their access to shared data.
MXDW Waiting for the completion of an I/O operation to a mixed device file.
OPTA Waiting in a pool activity level for the completion of an I/O operation to an optical device.
OPTW Waiting for the completion of an I/O operation to an optical device.
OSIW Jobs waiting for the completion of an OSI Communications Subsystem for OS/400 operation.
PRTA Waiting in a pool activity level for output to a printer to complete.
PRTW Waiting for output to a printer to be completed.
PSRW A prestart job waiting for a program start request.
RUN Currently running in the pool activity level.
SELW Waiting for a selection to complete.
SEMW Waiting for a semaphore. A semaphore is a synchronization function that is used to allow multiple jobs or threads to serialize their access to shared data.
SIGS Stopped as the result of a signal
SIGW Waiting for a signal
SRQ The suspended half of a system request job pair.
SVFA Waiting in a pool activity level for completion of a save file operation.
SVFW Waiting for completion of a save file operation.
TAPA The job is waiting in a pool activity level for completion of an I/O operation to a tape device.
TAPW Waiting for completion of an I/O operation to a tape device.
THDW Waiting for another thread to complete an operation.
TIMA Waiting in a pool activity level for a time interval to end.
TIMW Waiting for a time interval to end.
You also have the option of monitoring jobs for CPU percentage. This is done using *CXX where XX is the percentage you want to monitor for. If a job is found to have equal or higher CPU percentage than XX the command will be run. For example, *C50 will monitor for jobs with a CPU percentage of 50% and up.
When setting up a new entry in the Job Maintenance Screen the following status codes are available.
*ACTIVE -Only active jobs are counted towards the minimum jobs.
*JOBQ - Only jobs on a job queue are counted towards the minimum jobs.
*OUTQ - Only jobs on an output queue are counted towards the minimum jobs.
*ANY -Any jobs status is counted towards the minimum jobs.
*MINACT - Will check active jobs for the total minutes active against the value listed in MIN (which in this case will be the maximum number of minutes active before the command will be run).
Available Substitution Variables
When working with commands with the JOBWATCH Job Status Maintenance the following substitution variables are available:
&J - Job Name (10a)
&U - User Name (10a)
&N- Job Number (6a)
&A - Job Status (10a) - Note: This is not the active job status
&T - Job Type (1a)
&B - Job Subtype (1a)
&S - Job Active Status (ie MSGW, EVTW, RUN, etc...) (4a)
&M - Machine Name (8a)
&Y - Subsystem (10a)
&L - Subsystem Library (10a)
&F - Function Name (10a)
&E - Last Message Text from Job (4096a)
&C - Returns a list of objects locked by this job in the format (library,object,type,status)(library,object,type,status)... (1024a)
&K - Message Key (4a) - Only available on V6R1 and up.
&I - Internal Job ID (16a)
&CPU - CPU Percentage (9,2s)
The following additional replacement variables are available when using *MINACT from the Job Maintenance Commands:
&U - User ID
&N - Job Number
&T - Job Type
&B - Job Subtype
When working with commands with the JOBWATCH Job Maintenance the following substitution variables are available:
&J - Job Name (10a)
&M - Minimum Jobs/Maximum Minutes (10a)
&A - Actual Jobs/Actual Minutes (10a)
&S - Job Monitoring Status (7a)
When working with commands with the MSGQ Maintenance the following substitution variables are available:
&L = Message Queue Library (10)
&Q = Message Queue (10)
&I = Message ID (7)
&T = Message Type (13)
&S = Message Subtype(22)
&X = Message Text (1024)
&V = Message Severity (5)
&Z = Message Timestamp (26)
&U = From User (10)
&J = From Job (28)
&P = From Program (10)
&R = Message File Library (10)
&F = Message File (10)
&2 = Message Second Level Text (4096)
&M - Machine Name (8)