× 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.



On 6/14/2017 3:32 PM, John Yeung wrote:
Surely there is an accepted idiom (or a small number of generally used
idioms) to handle the case where you want to "monitor" a specific
diagnostic message.

I know you can't use MONMSG directly on the diagnostic message. So I
guess you use RCVMSG. How do you set this up so that if the diagnostic
message you were looking for isn't there, everything proceeds as
though you had never looked for the message in the first place?
(Meaning execution continues normally if there are no errors, but if
there is an error, it shows up exactly as it would have had you not
tried to handle the diagnostic message.)

I don't think that an error 'can show up exactly as it would have' -
there is no 'resignal' that I know of. So now it's more a matter of
'how close is close enough?' I do better with an actual business
problem in front of me, so I'll use my nightly backup as an example.

We do a SAVLIB, SAV, SAVDLO (don't judge me), SAVSECDTA. For some of
these saves, certain objects tend to be locked (like log files) and I
don't care if those are saved or not. When the save operation comes
across one of these objects, it throws out a *DIAG message. If any
*DIAG messages were thrown, the save throws out a *ESCAPE message. The
CLP monitors for the *ESCAPE and then rewinds back to the beginning to
see if all of the *DIAG messages were of the 'expected' sort, and if so,
quietly proceeds to the next step.

If any of the *DIAG messages were of the 'unexpected' sort, the CLP
throws an alert message to an IT monitoring message queue, and I, I mean
the person on duty, looks at the job log, where the original diagnostic
message is still available for perusal.

Ancient code fragments follow:

DCL &MSGID *CHAR 7

DCL &MSGDTA *CHAR 256

DCL &MSGdsp *char 50

dcl &msgkey *char 4

dcl &key_start *char 4

dcl &key_stop *char 4

dcl &expected *char 1 'Y'

...
/* get a message key that will serve to mark the start */

/* of the process we're monitoring */

sndpgmmsg 'start savlib' topgmq(*same) keyvar(&key_start)

rmvmsg msgkey(&key_start) /* optional */

...
SAVLIB LIB(*ALLUSR)...
MONMSG MSGID(CPF0000) exec(goto lib_err)
goto sav_str


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) /* optional */


/* calculate the first possible diagnostic message */

chgvar %bin(&msgkey 1 4) (%bin(&key_start 1 4) + 1)



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(HELPDESK)

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(HELPDESK)

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:

...
/* ============================================================= */

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(HELPDESK)
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.