Hi Chuck,

I have included the sources as plain text to circumvent any attachment
problems on Midrange-L.

I have used this utility for several years, with infrequent modification for
bug fixes and enhancements.  Have a read through it and verify that on YOUR
system it does not break any house-rules.

Command Source:

             CMD        PROMPT('Clean message queue')
             PARM      KWD(MSGQ) TYPE(QUAL1) MIN(1) PROMPT('Message +
                           queue name')
QUAL1:  QUAL      TYPE(*NAME) LEN(10)
             QUAL      TYPE(*NAME) LEN(10) DFT(*LIBL) +
                           SPCVAL((*LIBL)) PROMPT('Library name')

             PARM     KWD(MSGTBL) TYPE(*CHAR) LEN(7) MIN(1) +
                          MAX(50) CHOICE('message id') +
                          PROMPT('Message id table')

CL Program Source:

             PGM        PARM(&MSGQ &MSGTBL)
/* In parms */
             DCL        VAR(&MSGQ)   TYPE(*CHAR) LEN(20)
             DCL        VAR(&MSGTBL) TYPE(*CHAR) LEN(352)
/* Work fields */
             DCL        VAR(&ARRIDX) TYPE(*DEC)  LEN(5 0)
             DCL        VAR(&MSGID)  TYPE(*CHAR) LEN(7)
             DCL        VAR(&MSGIDX) TYPE(*DEC)  LEN(7 0)
             DCL        VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
             DCL        VAR(&MSGKYD) TYPE(*CHAR) LEN(4)
             DCL        VAR(&MSGNUM) TYPE(*DEC)  LEN(5 0)
             DCL        VAR(&MSGQLB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSGQNM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSGTYP) TYPE(*CHAR) LEN(2)
             DCL        VAR(&RMVCNT) TYPE(*DEC)  LEN(5 0)
             DCL        VAR(&RMVCTC) TYPE(*CHAR) LEN(6)
             DCL        VAR(&WKC002) TYPE(*CHAR) LEN(2)
             DCL        VAR(&WKC007) TYPE(*CHAR) LEN(7)
             DCL        VAR(&WKD005) TYPE(*DEC)  LEN(5 0)

/* Initialisation */
             MONMSG     MSGID(CPF0000 MCH0000) EXEC(GOTO +
                                  CMDLBL(LBL990))
   /* Unpack Message Queue Qaulified-Name */
             CHGVAR      VAR(&MSGQNM) VALUE(%SST(&MSGQ 1 10))
             CHGVAR      VAR(&MSGQLB) VALUE(%SST(&MSGQ 11 10))
   /* Unpack & convert number of msgid-elements */
             CHGVAR      VAR(&WKC002) VALUE(%SST(&MSGTBL 1 2))
             CVTBINDEC  FROMBIN(&WKC002) TODEC(&MSGNUM)
   /* Extract message-id table data */
             CHGVAR      VAR(&WKD005) VALUE(&MSGNUM * 7)
             CHGVAR      VAR(&MSGTBL) VALUE(%SST(&MSGTBL 3 &WKD005))

/* Message Queue Processing */
   /* Position to first message */
             CHGVAR      VAR(&MSGKEY) VALUE('*TOP')
   /* Receive next message */
 LBL010:     RCVMSG     MSGQ(&MSGQLB/&MSGQNM) MSGTYPE(*NEXT) +
                          MSGKEY(&MSGKEY) RMV(*NO) KEYVAR(&MSGKEY) +
                          MSGID(&MSGID) RTNTYPE(&MSGTYP)
   /* until no more */
 LBL020:     IF     COND(&MSGKEY = '    ') +
                         THEN(GOTO CMDLBL(LBL990))
   /* Skip inquiry messages */
             IF         COND(&MSGTYP = '05') +
                          THEN(GOTO CMDLBL(LBL010))

/* MSGID Table processing */
             CHGVAR     VAR(&ARRIDX) VALUE(0)
 LBL030:     CHGVAR     VAR(&ARRIDX) VALUE(&ARRIDX + 1)

             IF             COND(&ARRIDX *LE &MSGNUM) +
             THEN(DO)
             CHGVAR     VAR(&MSGIDX) VALUE(&ARRIDX * 7 - 6)
             CHGVAR     VAR(&WKC007) VALUE(%SST(&MSGTBL &MSGIDX 7))
             IF            COND(&MSGID = &WKC007) +
             THEN(DO)
             CHGVAR     VAR(&MSGKYD) VALUE(&MSGKEY)
             RCVMSG     MSGQ(&MSGQLB/&MSGQNM) MSGTYPE(*NEXT) +
                                 MSGKEY(&MSGKEY) RMV(*NO) KEYVAR(&MSGKEY) +
                                 MSGID(&MSGID) RTNTYPE(&MSGTYP)
             RMVMSG     MSGQ(&MSGQLB/&MSGQNM) MSGKEY(&MSGKYD)
             CHGVAR     VAR(&RMVCNT) VALUE(&RMVCNT + 1)
             GOTO        CMDLBL(LBL020)
             ENDDO
             GOTO        CMDLBL(LBL030)
             ENDDO
             GOTO        CMDLBL(LBL010)

/* Completion message */
LBL990:      CHGVAR     VAR(&RMVCTC) VALUE(&RMVCNT)
             SNDPGMMSG  MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
                          MSGDTA(&RMVCTC *BCAT 'messages deleted +
                          from' *BCAT &MSGQLB *TCAT '/' *TCAT +
                          &MSGQNM) MSGTYPE(*COMP)
             RETURN
             ENDPGM

The Prompted Command:

                         Clean message queue (CLNMSGQ)
 

Type choices, press Enter.

 

Message queue name . . . . . . . QSYSOPR           Name
  Library name . . . . . . . . .            *LIBL             Name, *LIBL
Message id table . . . . . . . .       xxxxxxx              message id
               + for more values                               (up to 50
entries)


Kind regards,

Jeffrey E. Bull
OS400 Software Support Consultant

IBM Certified Systems Expert, iSeries Technical Solutions
IBM Certified Systems Specialist, AS/400 System Administration

*      +44 [0] 149 454 9533               swb.   +44 [0] 149 454 9400
mbl.     +44 [0] 786 750 4961               fax.    +44 [0] 149 454 9454
web.     http://www.itm-group.co.uk
 
ITM Group Ltd, Latimer Square, White Lion Road, Amersham, Buckinghamshire,
HP7 9JQ, United Kingdom


-----Original Message-----
From: Chuck Lewis [mailto:clewis@xxxxxxxxxx]
Sent: 02 March 2004 18:04
To: 'Midrange Systems Technical Discussion'
Subject: RE: Is there a way to delete a specific message from QSYSOPR ?
Trying again :-)


Definitely would be interested Jeff; thanks !

Chuck

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Bull
Sent: Tuesday, March 02, 2004 10:52 AM
To: 'Midrange Systems Technical Discussion'
Subject: RE: Is there a way to delete a specific message from QSYSOPR ?
Trying again :-)

Hi Check,
        I have a utility (written in CL) that I have plugged into the
scheduler, it runs once an hour through the day, that processes the QSYSOPR
message queue, deleting unwanted/routine messages by MsgId.  Provided the
MsgId is always the same, and there are not others with the same MsgId that
you want to keep ... CLNMSGQ may be what your after, if you're interested.

Kind regards,

Jeffrey E. Bull
OS400 Software Support Consultant

IBM Certified Systems Expert, iSeries Technical Solutions
IBM Certified Systems Specialist, AS/400 System Administration

*      +44 [0] 149 454 9533               swb.   +44 [0] 149 454 9400
mbl.     +44 [0] 786 750 4961               fax.    +44 [0] 149 454 9454
web.     http://www.itm-group.co.uk
 
ITM Group Ltd, Latimer Square, White Lion Road, Amersham, Buckinghamshire,
HP7 9JQ, United Kingdom


-----Original Message-----
From: Chuck Lewis [mailto:clewis@xxxxxxxxxx]
Sent: 02 March 2004 15:15
To: midrange-l
Subject: Is there a way to delete a specific message from QSYSOPR ?
Trying again :-)


Hi Folks,

 

I have an application that monitors QSYSOPR for a certain condition (the
failure of our fax server) and then emails certain folks if there is a
problem. This is scheduled through Robot and runs every 15 minutes. Problem
is, if it fails during the night, the first email alert is sent and then
every 15 minutes it finds the same, unanswered or undeleted, error message
on QSYSOPR and sends another one. I did have this checking every 5 minutes
and that yielded a TON of emails. We know what the problem is, network
congestion and it times out (we are working on this) and the server attempts
to reboot and reload itself. This doesn't happen a lot, but I would like to
be able to delete the one message since folks that are responsible for this
get an email and should act on it during normal hours or will get to it when
they get the email in the morning.

 

Thanks !

 

Chuck

_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


________________________________________________________________________
This e-mail has been scanned for all viruses by ITM. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, 
email marketing@xxxxxxxxxxxxxxx
ITM - Managing Communication and Information through technology
Company registration number - 3783433
________________________________________________________________________


DISCLAIMER

Any opinions expressed in this email are those of the
individual and not necessarily the Company. This email
and any files transmitted with it, including replies and
forwarded copies (which may contain alterations) 
subsequently transmitted from the Company, are 
confidential and solely for the use of the intended recipient. If you are
not the intended recipient or the 
person responsible for delivering to the intended recipient, 
be advised that you have received this email in error and
 that any use is strictly prohibited.

If you have received this email in error please notify the IT
manager by telephone on +44 (0)870 871 2233 or via 
email to Administrator@xxxxxxxxxxxxxxx, including a copy
of this message. Please then delete this email and 
destroy any copies of it.

________________________________________________________________________This
e-mail has been scanned for all viruses by ITM. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, 
email marketing@xxxxxxxxxxxxxxx
ITM - Managing Communication and Information through technology
Company registration number -
3783433_____________________________________________________________________
___
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


________________________________________________________________________
This e-mail has been scanned for all viruses by ITM. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, 
email marketing@xxxxxxxxxxxxxxx
ITM - Managing Communication and Information through technology
Company registration number - 3783433
________________________________________________________________________


DISCLAIMER

Any opinions expressed in this email are those of the
individual and not necessarily the Company. This email
and any files transmitted with it, including replies and
forwarded copies (which may contain alterations) 
subsequently transmitted from the Company, are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the 
person responsible for delivering to the intended recipient, 
be advised that you have received this email in error and
 that any use is strictly prohibited.

If you have received this email in error please notify the IT
manager by telephone on +44 (0)870 871 2233 or via 
email to Administrator@xxxxxxxxxxxxxxx, including a copy
of this message. Please then delete this email and 
destroy any copies of it.

________________________________________________________________________This 
e-mail has been scanned for all viruses by ITM. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, 
email marketing@xxxxxxxxxxxxxxx
ITM - Managing Communication and Information through technology
Company registration number - 
3783433________________________________________________________________________

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2022 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.