Home > AS/400 Tips > iSeries administrator tips > Job status monitoring
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Job status monitoring


Jozsef Petrovszki
07.18.2001
Rating: -3.77- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


If you use these programs you increase your "freedom". You do not have to check the active jobs every minute. Just submit the first CL program and it will send you a message when any job is in the specified status (MSGW, HLD etc.) The idea is not to only watch the job status. I think it is more. If you modify the program it can alert you, when a specified user signed on or a specified subsystem started etc.

- You do not have to use the WRKACTJOB in this program. If you use WRKCFGSTS you can monitor a LINE,CTL,DEV etc. when became active.

- The type of alert can be modified too. I use SNDDST to send an e-mail to my address at my mobile phone provider. I use a mail notification service and they send me an SMS when I get an e-mail. The SMS contains the subject of e-mail sent by the AS/400. It works fine. It is good thing, when I started a lot of jobs to run for the weekend and those have to finish by Monday morning. I can be sure there is no MSGW or HLD status! I use SNDBRKMSG when I'm in a computer room or in my workshop. Easy to hear a big beep if an MSGW occur while you use another application!

It is a simple solution for daily problems, made in CL without API-s and easy to understand. We have used this for about 3 years. It became a standard and helpful tool for us! If you have any questions about this tip, you can e-mail Jozsef Petrovszki. Additional tip: If you use serial jobq to run your jobs, submit an SNDDST or SNDBRKMSG command after the jobs and you will be notified when all your jobs finished!



Code

 1st. Caller program: Compile to name ALERT
the code:

PGM        PARM(&STS)                                     
             DCL        VAR(&ERROR) TYPE(*CHAR) LEN(1)                 
             DCL        VAR(&STS) TYPE(*CHAR) LEN(4)                   
             DCL        VAR(&TXT) TYPE(*CHAR) LEN(60)                  
                                                                       
START:       OVRPRTF FILE(QPDSPAJB) HOLD(*YES)                         
             WRKACTJOB  OUTPUT(*PRINT)                                 
             DLTOVR FILE(QPDSPAJB)                                     
             CHKOBJ     OBJ(QTEMP/ALERTJOB) OBJTYPE(*FILE)             
             MONMSG     MSGID(CPF9801) EXEC(DO)                        
             CRTPF      FILE(QTEMP/ALERTJOB) RCDLEN(132)               
             ENDDO                                                     
             CPYSPLF    FILE(QPDSPAJB) TOFILE(QTEMP/ALERTJOB) +
                        SPLNBR(*LAST)                               
             DLTSPLF    FILE(QPDSPAJB) SPLNBR(*LAST)                  
                                                                      
             CALL       PGM(yourlib/ALERTW) PARM(&STS &ERROR &TXT)      
             IF         COND(&ERROR *EQ '1') THEN(DO)                 
             SNDDST TYPE(*LMSG) TOINTNET((yourname@yourmobilephoneprovider.com)) +
                        DSTD('alert') LONGMSG(B) SUBJECT(&TXT)                                  
             SNDBRKMSG  MSG(&TXT) TOMSGQ(DSP01 DSP02 DSP06 DSP07)     
             GOTO       CMDLBL(END)                                   
             ENDDO                                                    
             DLYJOB     DLY(180)                                      
             GOTO       CMDLBL(START)                                 
END:       ENDPGM 

2nd: Finder program: Compile to name ALERTW This program called by the first CL program (ALERT) Before you compile it you have to create a workfile in qtemp with CRTPF FILE(QTEMP/ALERTJOB) RCDLEN(132) command!

 
PGM PARM(&STS &ERROR &TXT)                                           
             DCL        VAR(&STS) TYPE(*CHAR) LEN(4)                 
             DCL        VAR(&ERROR) TYPE(*CHAR) LEN(1)               
             DCL        VAR(&TXT) TYPE(*CHAR) LEN(60)                
                                                                     
             DCLF       FILE(QTEMP/ALERTJOB)                         
             CHGVAR     VAR(&ERROR) VALUE('0')                       
READ:        RCVF       RCDFMT(ALERTJOB)                             
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))        
             IF         COND(%SST(&ALERTJOB 111 4) *EQ &STS) +       
                          THEN(DO)                                   
             CHGVAR     VAR(&ERROR) VALUE('1')                       
             CHGVAR     VAR(&TXT) VALUE(&STS *CAT ' status : ' *CAT +
                          %SST(&ALERTJOB 29 6) *CAT '/' *CAT +            
                          %SST(&ALERTJOB 17 10) *TCAT '/' *CAT +          
                          %SST(&ALERTJOB 4 10) *CAT '!!!')                
             ENDDO                                                        
             GOTO READ                                                    
END:         ENDPGM 

Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries system performance and monitoring
Analyze the health of your IBM i server with iScore
Translating Linux for IBM i admins: Working with jobs and networking
Database performance comparisons on IBM i
How to: Monitoring job activity on the AS/400
Performance tuning for IBM i: The basics and beyond
How to: Reduce the percentage of ASP used on the AS/400
Detecting system changes made by outside IP address
AS/400 system values quiz
Checking on System i disk space requires creating a new command: XRTVSYSSTS
Drive space management commands

Implementation
Getting modules to adopt authorities from the main program
iSeries i5/OS: Top 10 Q&As
iSeries i5/OS: Top 10 Q&As
Using the SPLF0200 format in QUSLSPL API
New option within the WRKSYSACT command
Identify files used in all queries
Security Tools can help manage your system security
Client Access Express password cache
Check constraint allows database admins to sleep a bit better at night
See the users with *change or *all authority
Implementation Research

Performance
Will overloaded discs impact iSeries performance?
Extend storage capacity on an IBM i without negatively effecting system performance
Database drivers on the i: MySQL vs. IBM Toolbox
Performance tuning for IBM i: The basics and beyond
IBM releases new Power products for the midrange
Top System i admin tips for 2006
Catholic Charities keeps track of homeless with iSeries
i5 error messages: What you need to know
IBM races for clock speed
System shutting down after cleanup

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
CIW  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts