Automate iSeries Backup Checking using CLP

20 pts.
Tags:
AS/400
CLP
CLPROGRAM
DSPLOG
iSeries
Hi there, I have created a CLP (I'm not really good at CL) that will run on request via scheduler after a backup has completed. It will check through the Hist Log looking for specific failure msgs. If it finds them it should email oncall support. Not sure if there is a better way to do it but I have pasted the CLP below. So on a normal day it should not find any error msgs - and the DSPLOG cmd should throw a CPF2447 (which I am montoring for) but this does not seem to have the desired result.

I'd appreciate any alternative ideas, on how to achieve a similar result, no matter how complex.

 

PGM  

DCL VAR(&TODAY) TYPE(*CHAR) LEN(6) /*CURRENT JOB DATE*/

 

DCL VAR(&TODAYJ) TYPE(*CHAR) LEN(7) /* JULIAN FMT */

 

DCL VAR(&ONEDAYDEC) TYPE(*DEC) LEN(7 0) /* - 1 D*/

 

DCL VAR(&ONEDAYJ) TYPE(*CHAR) LEN(7) /* - 1 DAY JUL*/

 

DCL VAR(&TODAYDEC) TYPE(*DEC) LEN(7 0) /*TODAY DEC*/

 

DCL VAR(&MINONEDAY) TYPE(*CHAR) LEN(6)

 

DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6) /*JOB NUMBER*/

 

DCL VAR(&JOB) TYPE(*CHAR) LEN(10) /* JOB */

 

DCL VAR(&USER) TYPE(*CHAR) LEN(10) /*USER OF JOB */

 

DCL VAR(&DAY) TYPE(*CHAR) LEN(4) /*DAY OF WEEK*/

 

 

/* RETRIEVE CURRENT DATE*/

 

RTVJOBA DATE(&TODAY) DAYOFWEEK(&DAY)

 

/* RETRIEVE CURRENT JOB NUMBER */

 

RTVJOBA JOB(&JOB) USER(&USER) NBR(&NUMBER)

 

/*CONVERT TO JULIAN DATE*/

 

CVTDAT DATE(&TODAY) TOVAR(&TODAYJ) TOFMT(*LONGJUL) +

 

TOSEP(*NONE)

 

/*CHANGE TO DECIMAL*/

 

CHGVAR VAR(&TODAYDEC) VALUE(&TODAYJ)

 

/* SUBTRACT 1 WK*/

 

CHGVAR VAR(&ONEDAYDEC) VALUE(&TODAYDEC - 1)

 

/*CHANGE BACK TO CHAR JUL*/

 

CHGVAR VAR(&ONEDAYJ) VALUE(&ONEDAYDEC)

 

/*CONVERT BACK TO DMY FORMAT*/

 

CVTDAT DATE(&ONEDAYJ) TOVAR(&MINONEDAY) FROMFMT(*LONGJUL) +

 

TOFMT(*DMY) TOSEP(*NONE)

 

DAYTEST: IF COND(&DAY *EQ '*SUN') THEN(GOTO CMDLBL(BACKUPBADW))

 

ELSE CMD(IF COND(&DAY *NE '*SUN') THEN(GOTO +

CMDLBL

(BACKUPBADD)))

 

/* search for error conditions */

 

BACKUPBADW: DSPLOG PERIOD(('18:00:00' &MINONEDAY)) OUTPUT(*PRINT) +

 

MSGID(BRM1646 BRM2265 BRM3D1D CPFB8C4 BRM1820 +

CPF3794 BRM1033 BRM1484 CPF3763 CPC2402 BRM2259

+

CPF3795 CPF3808

)

 

MONMSG MSGID(CPF2447) EXEC(GOTO CMDLBL(BACKUPGOOD))

 

BADEMAIL: SNDDST TYPE(*LMSG) +

 

TOINTNET((IT_Systems_Administrators@company.com +

 

*PRI) (oncall@supbackup1.company.com *PRI)) +

 

DSTD(EMAIL) LONGMSG('There are errors in the +

Qsupas2 Backup Report. Please review the backup

 

+

report for further details & rerun the backups

 

+

if required.'

 

) SUBJECT('QSUPAS2 BACKUPS FAILED')

 

GOTO CMDLBL(END)

 

BACKUPBADD: DSPLOG PERIOD(('18:00:00' &MINONEDAY)) OUTPUT(*PRINT) +

 

MSGID(BRM1646 BRM2265 BRM3D1D CPFB8C4 BRM1820 +

CPF3794 BRM1033 BRM1484 CPF3763 CPC2402 BRM2259

+

CPF3795 CPF3808

)

 

MONMSG MSGID(CPF2447) EXEC(GOTO CMDLBL(BACKUPGOOD))

 

BADEMAILD: SNDDST TYPE(*LMSG) +

 

TOINTNET((IT_Systems_Administrators@company.com +

 

*PRI) (IT_Operations@company.com *PRI)) +

 

DSTD(EMAIL) LONGMSG('There are errors in the +

Qsupas2 Backup Report. Please review the backup

 

+

report for further details & rerun the backups

 

+

if required.'

 

) SUBJECT('QSUPAS2 BACKUPS FAILED')

 

GOTO CMDLBL(END)

 

BACKUPGOOD: DSPLOG PERIOD(('18:00:00' &MINONEDAY)) OUTPUT(*PRINT) +

 

MSGID(CPF3700 CPC1236 CPC3722 CPC3736 CPC3732 +

CPC3721 CPC3837 BRM1049 BRM1380 BRM1058 BRM1683

+

BRM1454 CPF3800 CPF9800 BRM14A1 BRM10A1 CPFB8ED

+

CPFA0DC CPFA0DB CPF5729 CPFB8ED OPT1332 BRM1484

)

 

GOODEMAIL: SNDDST TYPE(*LMSG) +

 

TOINTNET((IT_Systems_Administrators@company.com +

 

*PRI) (IT_Operations@company.com *PRI)) +

 

DSTD(EMAIL) LONGMSG('The Qsupas2 Backup Report +

has been run. There are no major errors

 

+

reported. Please review the backup report for

 

+

further details.'

 

) SUBJECT('Qsupas2 Backups +

Successfull'

 

)

 

END: ENDPGM





Software/Hardware used:
iSeries V6R1

Answer Wiki

Thanks. We'll let you know when a new response is added.

What type of save is running? Is it a Full Save via option 21, 23. etc. or a CL submitted backup? If it’s a CL, it would be easier to incorporate the error msg handling within the backup program.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Stefche
    The save is done using a BRMS Control Group & submitted via the Job Scheduler.
    20 pointsBadges:
    report
  • TomLiotta
    So on a normal day it should not find any error msgs - and the DSPLOG cmd should throw a CPF2447 Although it won't find any of the messages that you requested, it's almost guaranteed to find some messages. The CPF2447 isn't thrown because there were no matches from your MSGID() list. It's thrown because the current history log message queue is empty. (Well, not exactly, but that's as close as you need for this case.) For a basic CL program, it's not bad. But it'll take a different method to find the information you're looking for. To get an idea of how tricky QHST processing can be, read the QHST history log topic in the Information Center. (The topic is practically the same regardless of OS version.) Read the subtopics too. I don't use BRMS, so I'm not the first choice on suggesting better methods. I'm pretty sure that QHST processing won't be in the top couple of alternatives. I'd expect a more automated method from BRMS. Tom
    125,585 pointsBadges:
    report
  • pdraebel
    We do use BRMS at our shop. I have one CL that is scheduled to run every night and this Basically selects which control group to run and issues a STRBKUGRP with SUBMIT(*NO). There is a MONMSG(BRM1820) for the Command and if that is encountered there was something wrong with the processing of the control group and an **ATTENTION** mail is sent out so operators can check what went wrong. You may need to check BRMS configuration for Presentation Controls because you can set if BRMS is to Handle exceptions or if you will monitor that. Cant tell by heart what it is though.
    2,580 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following