Home > Ask the AS/400 Experts > iSeries Application Development Questions & Answers > Monitoring escape messages and using RCVMSG for diagnostic messages
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

Monitoring escape messages and using RCVMSG for diagnostic messages

John Blenkinsop EXPERT RESPONSE FROM: John Blenkinsop

Pose a Question
Other iSeries 400 Categories
Meet all iSeries 400 Experts
Become an Expert for this site


iSeries news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 19 June 2008
I've written a program to help the user load and install his PTFs. I am loading the CDs into image files, and there comes my problem: When loading an image, three different problems occur, which I want to handle separately.
  1. The image catalog entry may already exist (same CD inserted twice)
  2. The image file was not deleted on the IFS
  3. There is no CD inserted

I want to handle these three cases separately, but I did not find out how to monitor the information messages produced. The only message I can monitor is the CPFBC28, but I need OPT1660 (no CD), CPDBC19 (IMGF exists) and CPDBC29 (IMGCLGE exists).



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



RELATED CONTENT
iSeries Application Development
Listing contents of multiple FTP directories on AS/400
Chain operation error after converting RPG3 to ILE RPG (RPGIV)
Space offset X'0015FF00' or X'0000000000000000' is outside current limit for object QIGC2424C
Searching fields for values
iSeries application display subfiles with other program windows
Searching part of a name or address in AS/400
Passing parameters in an ILE RPG module
What's happening to my subfile?
What happening to my subfile?
What is a Decimal Data Error?

iSeries programming commands
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Date calculation commands for AS/400
iSeries application display subfiles with other program windows
Creating a user profile from a file
DSPPGMREF (Display Program Reference)
DSPPGM (Display Program)
DSPFD (Display File Description)
DSPPTF (Display PTF)
Top 10 iSeries commands
iSeries programming commands Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Quiz: iSeries (AS/400) Commands  (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


The following code will work for this problem: Original code:

 MONMSG     MSGID(CPFBC28) EXEC(GOTO CMDLBL(NOCD1))  /*

temporary to make it work
/* MONMSG MSGID(OPT1660) EXEC(GOTO CMDLBL(NOCD1)) */
/* These are the three
/* MONMSG MSGID(CPDBC19) EXEC(GOTO CMDLBL(IMGFEXT1)) */
/* messages I want to
/* MONMSG MSGID(CPDBC29) EXEC(GOTO CMDLBL(IMGCEXT1)) */
/* check for
GOTO CMDLBL(CD1CONT)

Solution:

MONMSG     MSGID(CPFBC28) EXEC(DO)
RCVMSG     MSGTYPE(*DIAG) MSGID(&MGID)
    IF         COND(&MGID *EQ 'CPDBC19') THEN(GOTO

CMDLBL(IMGFEXT1))
    IF         COND(&MGID *EQ 'CPDBC29') THEN(GOTO

CMDLBL(IMGCEXT1))
  GOTO       CMDLBL(NOCD1)
       ENDDO
  GOTO       CMDLBL(CD1CONT)

The CPD and OPT messages are diagnostic messages, not escape messages, so they cannot be monitored. When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor.

So, you see the escape message, and then you use the RCVMSG command to get the last diagnostic message sent to your program. The variable &MGID is *CHAR 7, and will contain the message ID of the diagnostic message, or will be blank if there was no diagnostic message to receive.

Inside the DO group there is an unconditional GOTO to catch an error that did not return the diagnostic message you expected. There is no need to check for the OPT1660 message because its destination is the same as the unconditional GOTO.




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



iSeries Networking - Printing, Remote Access, TCP/IP
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