Home > AS/400 Tips > iSeries programmer tips > Message break-handling program helps you monitor inquiry messages
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Message break-handling program helps you monitor inquiry messages


Bill Greenlee
04.10.2001
Rating: -3.89- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


It is tedious to enter DSPMSG repeatedly to check messages and inconvenient to have work interrupted in *BREAK mode for every 'Job completed...' message. However, I don't want inquiry messages sitting without response for long periods. Instead, I have a break-handling program that manages incoming messages according to what kind of message is received. Messages requiring a response will break into my current job. Other messages display, as they are received, on the message line without interrupting me.



Code

/* The following three input parameters are standard for a + 'Break Handling' program. */

PGM PARM(&MSGQ &MSGQLIB &MSGKEY)

DCL &MSGQ *CHAR 10 /* Queue where the msg is. */
DCL &MSGQLIB *CHAR 10 /* Queue library. */
DCL &MSGKEY *CHAR 4 /* Key of the received msg. */
DCL &MSGID *CHAR 7 /* ID of the received msg. */
DCL &RTNTYPE *CHAR 2 /* Type of the received msg. */
DCL &MSG *CHAR 78 /* Msg text. */
DCL &OPEN *CHAR 1 VALUE(X'21') /* Rev img. attrib. */
DCL &CLOSE *CHAR 1 VALUE(X'20') /* Normal attrib. */

/* When your message queue is in *BREAK mode and a +
break handling program is assigned, the program +
is automatically called when a message arrives +
and the three parameters are apssed so that the +
message can be received. */

RCVMSG MSGQ(&MSGQLIB/&MSGQ) MSGKEY(&MSGKEY) +
RMV(*NO) MSG(&MSG) MSGID(&MSGID) +
RTNTYPE(&RTNTYPE)

/* Message type '05' is an *INQ type message. Show +
the 'Display Messages' screen so that the message +
can be responded to. */
IF COND(&RTNTYPE = '05') THEN(DSPMSG +
MSGQ(&MSGQLIB/&MSGQ))

/* When a batch job you have submitted gets an error +
message in QSYSOPR, you get a CPI2404 sent to you. +
Display QSYSOPR msgq so that you can respond. */
ELSE CMD(IF COND(&MSGID = CPI2404) THEN(DSPMSG +
MSGQ(QSYSOPR)))

/* All others just display as a *STATUS message. */
/* The &OPEN and &CLOSE are hex display attributes that +
cause the status message to be shown in reverse +
image. */
ELSE CMD(SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA(&OPEN *CAT &MSG *TCAT ' - ' *CAT +
&MSGID *CAT &CLOSE) TOPGMQ(*EXT) +
MSGTYPE(*STATUS))

_

Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

RPG iSeries programming
Enhancing RPG with external SQL stored procedures
Introduction to SQLRPGLE on IBM i: Making a report
Making the most of RPG data handling on IBM i
IBM i shop boosts online sales with RPG-based Web platform
Migrating from RPG to EGL on IBM i
Allow access to data from a stored procedure result set using COBOL or RPG
EGL Rich UI on IBM i: Do you Dojo?
Programming for the Web on the IBM i, what is possible
A taste of COMMON: ILE, IBM releases, Web applications and new products
Documenting nested program structures on the AS/400

iSeries ILE programming
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
How to use an embedded SQL statement and display the result in a subfile
Eight steps for creating program documentation using AS/400 utilities
Searching fields for values
Searching part of a name or address in AS/400
Top 10 programmer tips YTD
How to use the binder language to manage service programs -- Part 3: Examples and pitfalls
Top 10 programmer tips of 2005
How to use the binder language to manage service programs -- Part 2: Understanding the binder language

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Report Program Generator  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts