× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hey Buck

Nice use of IBM's recommended technique for getting all messages in the job log, no matter where they come from - sometimes things show up from things no longer in the stack.

Vern

On 9/28/2016 10:06 AM, Buck Calabro wrote:
On 9/27/2016 7:01 PM, Jerry Draper wrote:
In our backup routine we do a:

SAVLIB *ALLUSR
SAVDLO
SAV (ifs)

We want to monitor the SAVLIB for CPF3777 (not all libs saved) and ignore
it

However we want to monitor for any other message and do a SNDPGMMSG if
that happens.

How can we do this?
What I do is a bit different to that. I monitor for any exception
message, not just CPF7777 -- but only if the messages are 'unexpected'.
For instance, there are some Robot data areas which are locked. OK, not
a big deal; we'll ignore those. However, if any /other/ data areas were
locked, the CLP bubbles up the message.

The first thing the CLP does is 'marks' the start of each save block:

/* get a message key that will serve to marke the start */
/* of the process we're monitoring */
sndpgmmsg 'start savlib' topgmq(*same) keyvar(&key_start)
rmvmsg msgkey(&key_start)

Then it does the save command:

SAVLIB LIB(*ALLUSR)...

If any exception message occurs, trap it:

MONMSG MSGID(CPF0000) exec(goto lib_err)

If no exception, move along to the next save block. In this case, it's SAV:

goto sav_str


So an exception occurred during SAVLIB. Deal with it:

lib_err:
/* get a message key that will serve to mark the end */
/* of the process we're monitoring */
sndpgmmsg 'stop savlib' topgmq(*same) keyvar(&key_stop)
rmvmsg msgkey(&key_stop)

/* calculate the first possible diagnostic message */
chgvar %bin(&msgkey 1 4) (%bin(&key_start 1 4) + 1)

Start reading the diagnostic messages beginning with the 'marker'
message we seeded the process with:

getlibmsg:
/* get the diagnostic message */
RCVMSG PGMQ(*SAME (*)) +
MSGTYPE(*DIAG) RMV(*no) MSGDTA(&MSGDTA) +
MSGID(&MSGID) msgkey(&msgkey)
monmsg cpf2410 exec(do) /* msg not found */
rcvmsg msgtype(*excp) rmv(*yes) /* delete unwanted msg */
goto nxtlibmsg
enddo

/* if empty, all done */
if (&msgid *eq ' ') goto sav_str

/* here is where we see if the messages are ones */
/* we know about or not. If the message being */
/* considered is NOT one we expect, set the flag */

/* some *diag messages we expect and don't worry about */
/* cpf4198 open seqonly(*yes) */
/* cpf3761 cannot use object */
/* cpf3771 x objects saved, y objects not saved */
/* cpf4024 tape density difference */
if ((&msgid *ne 'CPF4198') *and +
(&msgid *ne 'CPF3761') *and +
(&msgid *ne 'CPF3771') *and +
(&msgid *ne 'CPFA0A9') *and +
(&msgid *ne 'CPF4024')) do
chgvar &expected 'N'
chgvar &msgdsp ('Unexpected SAVLIB message ' *cat &msgid)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
msgdta(&msgdsp) +
MSGTYPE(*info) tousr(qsysopr)
MONMSG (CPF0000 MCH0000)
goto sav_str
enddo

/* check out the 'cannot use' messages' */
if (&msgid *ne 'CPF3761') do
goto nxtlibmsg
enddo

/* 'OBJECT TYPE LIBRARY ' */
if ((&msgdta *ne 'ALLFTM100 DTAQ ALLFTM100 ') *and +
(&msgdta *ne 'ALLFTMRTY DTAARA ALLFTM100 ') *and +
(&msgdta *ne 'RSL550DA DTAARA RBTSYSLIB ') *and +
(&msgdta *ne 'RBT542DA DTAARA ROBOTLIB ') *and +
(&msgdta *ne 'RBT635 DTAARA ROBOTLIB ') *and +
(&msgdta *ne 'RBT660 DTAARA ROBOTLIB ') *and +
(&msgdta *ne 'RBT695DA DTAARA ROBOTLIB ') *and +
(&msgdta *ne 'XLSCGIRMV DTAARA XLSCGI ') *and +
(&msgdta *ne 'QGLDLOCK USRSPC QUSRDIRDB ') *and +
(%sst(&msgdta 11 17) *ne 'MGTCOL QPFRDATA ')) do
chgvar &expected 'N'
chgvar &msgdsp ('Unexpected SAVLIB data ' *cat %sst(&msgdta 1 30))
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
msgdta(&msgdsp) +
MSGTYPE(*info) tousr(qsysopr)
MONMSG (CPF0000 MCH0000)
goto sav_str
enddo

nxtlibmsg:
/* increment the message key */
chgvar %bin(&msgkey 1 4) (%bin(&msgkey 1 4) + 1)
if (&msgkey *lt &key_stop) goto getlibmsg


/* At this point, job log gets CPF3777 nnn libraries saved */
/* ============================================================= */

sav_str:
/* get a message key that will serve to mark the start */
/* of the process we're monitoring */
sndpgmmsg 'start sav' topgmq(*same) keyvar(&key_start)
rmvmsg msgkey(&key_start)
...

At the very bottom, the CLP tests the value of &EXPECTED to see if we
had any abnormalities:

exitpgm:

/* see if we recognised all the unsaved objects or no */
if (&expected *eq 'N') do
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
msgdta('Scan backup joblog for CPF3761, CPF3771, +
CPF3741') +
MSGTYPE(*info) tousr(qsysopr)
MONMSG (CPF0000 MCH0000)
enddo




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.