345 pts.
 Email Alerts for AS/400 Subsystem not running
Hi, I want my i series to send me email alerts when any of the AS400 subsystems are not active. Please can some one let me know the CL code for this.

Software/Hardware used:
ASKED: March 31, 2009  11:59 AM
UPDATED: August 10, 2009  4:03 PM

Answer Wiki:
Hi, You'll probably need to use a WRKACTJOB OUTPUT(*PRINT) JOB(*SBS), copy the spooled output to a database file and read the database file to check which subsystems are active. <a href="http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/index.jsp?topic=/apis/qwdrsbsd.htm">Alternatively, there's an API that you can use.</a> Regards, Martin Gilbert. BTW, I think you r-click system, select monitors, then job.
Last Wiki Answer Submitted:  April 1, 2009  8:12 pm  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi Martin,

Thanks for your reply.

Unfortunately,I am not very familiar with CL scripting.Please can you let me know the remaining of the CL Code to follow once I make the output from WRKACTJOB.

Many Thanks in advance.

 345 pts.

 

Hi,

I just thought of another way of doing this, which involves no programming whatsoever.

You can use Ops Navigator/i-Series Navigator :-

Right click on your system, select Job. Give the monitor a name and description, type your subsystem name in under subsystem, click on add (you can add multiple subsystems here). Select the metrics tab, select job status, click on add, then in the lower pane, select end of job and click on add. Select the status threshold tab, select the “trigger when job is in any selected status” and fill in the trigger command with the command to send email. You can use &JOBNAME as a variable to give the subsystem name to your command.

Regards,

Martin Gilbert.

 23,625 pts.

 

hi Martin,

Thanks for the second method.

Unfortunately Ops Navigator is not installed on the AS400 and CL Programming seems to be the only way.

Will it be possible for you to give me some visibility of how to move ahead with CL..

Once agin thanks for all your help.

regards
Hughes

 345 pts.

 

Hi,

I like a challenge. One solution coming up.

Regards,

Martin Gilbert.

 23,625 pts.

 

Hi Hughes,

To start with you’re going to need a file with a list of the subsystems that you need to check, I’ll call it SBSCHK for this explanation, with a field name of SBSNAM (Subsystem name, 10 long character). You’ll need to fill the file with all the subsystems that you need to check (you can use UPDDTA for this).

You’ll then need a program to retrieve the data from this file and call a second program to check whether the subsystem retrieved is active :-

    PROGRAM1

PGM

/* Declare the subsystem file */
DCLF SBSCHK

/* Get a list of active subsystems into file QTEMP/WRKACTJOB */
OVRPRTF QPDSPAJB HOLD(*YES)
WRKACTJOB OUTPUT(*PRINT) JOB(*SBS)
CRTPF QTEMP/WRKACTJOB RCDLEN(132)
CPYSPLF FILE(QPDSPAJB) TOFILE(QTEMP/WRKACTJOB) SPLNBR(*LAST)
DLTSPLF FILE(QPDSPAJB) SPLNBR(*LAST)

/* Read and process the subsystem file */
READ: RCVF
MONMSG CPF0864 EXEC(GOTO ENDPGM)
CALL PROGRAM2 PARM(&SBSNAM)
GOTO READ

ENDPGM: ENDPGM

    PROGRAM2

PGM PARM(&SBSNAM)

/* Declare the file with active subsystems */
DCLF QTEMP/WRKACTJOB

READ: RCVF
MONMSG CPF0864 EXEC(GOTO ENDOFFILE)
/* If the subsystem name is found, then it’s active – the program is completed */
IF COND(%SST(&WRKACTJOB 2 10) *EQ &SBSNAM) THEN(GOTO ENDPGM)
GOTO READ

ENDOFFILE:
/* If your program gets here, the subsystem is not active, so insert your send e-mail command here, you can use &SBSNAM as the subsystem name in your email message */

ENDPGM: ENDPGM

To compile the programs, you’ll need the SBSCHK file in your library list. To compile the second program you’ll need to create the WRKACTJOB in your QTEMP (and compile the program interactively) – CRTPF QTEMP/WRKACTJOB RCDLEN(132). You may need to add some MONMSG checking for errors. You’ll also need to add your sommand for sending e-mail – see the comment in PROGRAM2.

Of course you can change the program names, file names or variable names as you see fit. Hope this gets you where you need to be. Please let me know if it works for you or if you have any problems with it.

Regards,

Martin Gilbert.

 23,625 pts.

 

Hi Martin,

Thanks a mill for all your help.

I can bottom this out now .Parallely I have started updating my CL as well.

I hope I can make this run now via the scheduler.:-)

Best Regards
Hughes

 345 pts.

 

Hi Hughes,

Maybe you’ll need another little CL to run the job every 5 minutes or so :-

PGM

LOOP: CALL PROGRAM1
/* Wait 5 minutes, then try again */
DLYJOB DLY(300)
GOTO LOOP

ENDPGM

Regards,

Martin Gilbert.

 23,625 pts.

 

Operations Navigator (i Series Navigator) is “installed” on every AS400. You need the client installed on your PC as part of Client Access (i Series Access). Very handy tool. Some functions can only be performed via Ops Nav.

 925 pts.

 

Yeah, Ops-Nav or iSeries Navigator is part of the IBM client suite that you install on your desktop PC.

The “monitors” are part of “Management Central”.
I’ve found that the monitors work best is they execute a command. The command can call a CL program.

Unfortunately, I don’t think IBM provided any simple way to send an email – which is probably what you want for alerts. There are lots of references on the web for setting up SMTP on the iSeries, also references for using monitors from Management central.

To be truthful, if you are not familiar or comfortable with CL programming, you might want to look at an off-the-shelf package for system monitoring. What it might save you in time would be worth the cost.

Regards
Mike

 2,725 pts.

 

Hi Guys,

Thanks a lot for all your advices.

I will currently work with Martins’ CL and that way I will also get achance to develop my CL Skills which becomes important for further process improvements on i series.

I also understand the importance of i Series Navigator amd will be installing the client on my PC so as to utilize the capabilities fully.

Regards
Hughes Williams

 345 pts.

 

Gilly400,
Using operations Nav can I put a monitor for a specific CPF message or severity code and have it send?

 1,780 pts.

 

Hi,

Yes, you can specify specific message queues, message Id’s, types (completion, inquiry, etc), severity less than, greater than, equal etc. It’s quite flexible.

Regards,

Martin Gilbert.

 23,625 pts.

 

Hi,
What about this situation? the subsystem(sbsA) is running, but one or two job is missing in sbsA.
How can check it by using CL?

Regards,
ddduck

 30 pts.

 

Configuring a monitor in Ops iNav is very easy as well as setting up email capability on the i5. As noted, there are many docs on the web to do this, here’s one:

http://search400.techtarget.com/news/article/0,289142,sid3_gci968106,00.html

I setup a QSYSOPR monitor for all RNQ* and RPG* inquiry messages as well as specific CPA messages. When a program errors, the monitor triggers the SNDDST command and an email is sent to specific techs as we are not a 24/7 shop. It also sends a text to their cell phone. This worked so well we were able to discontinue our contract with Robot Alert.

 5,665 pts.

 

But I dont have iSeries client access.
Do you think CL program can do that? and how?

 30 pts.

 

ddduck

you *do* have Navigator..

Maybe need to install that part onto your PC.

go take your Geeks gently by the neck and demand the CD, or discovewr where it lurks on the network.

 5,505 pts.

 

I DONT want have extra PC for monitor.
CL program is enough.

Any CL programming expert here?

thanks in advance.

 30 pts.

 

You don’t need an EXTRA PC – just the one you are using to access the iSeries now.

Or are you on a *real 5250/5291 or whatever dumb terminal?

Client access is the screen emulator almost everyone uses now – there are a couple of others, such as TN5250, but CA comes with the box, and does what it says, and includes all the components for being a screen, a printer (or several of them) connecting to multiple boxes, being a drag and drop interface with Navigator, writing SQL, drawing pretty SQL database referential drawings – just loads of stuff.

Try it – you’ll like it..

 5,505 pts.