How to display message in display file from a MSGF

620 pts.
Tags:
AS/400
DSPF
MSGF
How to display a message (essentially error message) at the bottom in display file (DSPF) from a Message File (MSGF)? Also in order to display more than one message, how do I go about that? I have a MSGF, wherein all the messages are pre-defined, which we have to use. Would greatly appreciate your prompt response. -- Svanky

Software/Hardware used:
as/400, db2/400

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    When you're using a display file, in order to display any data at all on a screen, you need to define the area that you want the data to show up in. For messages, this is done in one of two ways, either by way of the MSGLOC() keyword or by a "message subfile". Error messages can be involved with either one, but the kinds of errors generally break down to one kind or the other. . If the error is defined in the DSPF itself, for example by ERRMSG, ERRMSGID, SFLMSG or SFLMSGID keywords or by validation errors such as invalid dates entered into a 'date' type 'L' field, messages will display on the MSGLOC() line number. If the messages are sent by your program to the program's message queue, the messages will display on the lines defined for a message subfile. You can define both of those for the same line. . The MSGLOC() keyword is used at the file-level in DDS. It is limited to a single line, and only a single message will show at a time. A message subfile is defined by adding a small subfile and a subfile control format to your DDS. It can define as many lines on the screen as you want. Usually, only one or two lines are defined, but it's a subfile that the user can scroll through. All new messages from the program message queue will be loaded into the subfile automatically. . The MSGLOC() messages appear whenever their conditions are active, e.g., when their conditioning indicators are on when their records are written to the display. . Message subfile messages are sent to the program or procedure message queue of the program or procedure that is displaying the display file, and they appear when your program writes the message subfile control record. You would normally use the Send Program Message (QMHSNDPM) API to send the messages to the current call stack entry. . If you type [ message and subfile ] into the left-hand search box of the Information Center, you can find example DDS for a message subfile, as well as numerous subtopics about them. . Tom
    125,585 pointsBadges:
    report
  • LetItBe
    Create Message File (CRTMSGF) Add message IDs/messages in the message file. WRKMSGF LIBRARY/MESSAGE FILE Option 12 Work with message descriptions. F6 to add message IDs with message text. Include message subfile code in display file DDS source- A R SUBMSG TEXT('Message Subfile') A SFL A SFLMSGRCD(23) A MSGKEY SFLMSGKEY A MSGQ SFLPGMQ A R CTLMSG TEXT('Msg Sfl Control') A SFLCTL(SUBMSG) A OVERLAY A 35 SFLDSP A 35 SFLDSPCTL A 35 SFLINZ A 35 SFLEND A SFLSIZ(4) A SFLPAG(2) A MSGQ SFLPGMQ
    260 pointsBadges:
    report
  • svankipu
    Hi Tom! Thanks a lot for your post! but iam facing the followiing error while creating a simple MSGF. -------------------------------------- Call stack entry not found. Message subfile error on file MSGFCHKD in library PADDY. Permanent I/O error occurred (C G S D F). C C Error RPG1251 caused program MSGFCHKR to stop. My code is as below:- ======================================= Columns . . . : 1 71 Browse PADDY/QRPGSRC SEU==> MSGFCHKR FMT * ..... *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 *************** Beginning of data ************************************* 0010.00 * 0011.00 * FILE DESCRIPTION COLLECTION 0012.00 * 0013.00 FMSGFCHKDCF E WORKSTN 0030.00 * 0031.00 IAPIERR DS 256 0032.00 I B 1 40ERRLEN 0034.00 * CALCULATION SECTION 0035.00 *________________________________________________________________ 0054.00 C EXSR SR200 0065.00 C SETON LR End of Appli 0067.00 *---------------------------------------------------------------- 0068.00 * Display screen 0069.00 *---------------------------------------------------------------- 0070.00 C SR200 BEGSR 0071.00 * 0071.02 C MOVEL'GCE9001' MHMID 7 0071.03 C MOVEL'F03' MHMDTA 3 0071.04 C MOVE 3 MHMDTL 0071.09 C EXFMTSC0001 0074.00 C CHKCN1 IFEQ 'Y' 0075.00 C CHKCN1 OREQ 'N' 0076.00 C ELSE 0082.01 C EXSR SR400 0082.02 C GOTO SRNEND 0082.03 C ENDIF 0082.04 C CHKCN2 IFEQ '1' 0082.05 C CHKCN2 OREQ '2' 0082.06 C CHKCN2 OREQ '3' 0082.07 C CHKCN2 OREQ '4' 0082.08 C CHKCN2 OREQ '5' 0082.09 C ELSE 0082.10 C EXSR SR400 0082.11 C GOTO SRNEND 0082.12 C ENDIF 0082.13 * 0083.05 C SRNEND TAG 0083.06 C WRITEMSGCTL 0083.07 C EXFMTSC0001 0083.08 C EXSR SR500 0083.09 C EXFMTSC0001 0084.00 C ENDSR 0104.00 *---------------------------------------------------------------- 0105.00 *send of message to call message queue 0107.00 * 0108.00 C SR400 BEGSR 0115.00 * 0115.01 C MOVEL'TIMSGF' MSGPS 10 0115.02 C MSGPS CAT '*LIBL ' MHMSGF 20 0115.03 C MOVEL'*INFO ' MHMTYP 10 0115.04 C MOVE *BLANKS MHMKEY 4 0115.05 C Z-ADD132 MHMDTL 0115.06 * 0116.00 C CALL 'QMHSNDPM' 0117.00 C PARM MHMID 0118.00 C PARM MHMSGF 0119.00 C PARM MHMDTA 0120.00 C PARM MHMDTL 40 0121.00 C PARM MHMTYP 10 0122.00 C PARM '*' MHMSGQ 10 0123.00 C PARM MHSTAK 4 0124.00 C PARM MHMKEY 0125.00 C PARM APIERR 0126.00 * 0127.00 C ENDSR 0128.68 *---------------------------------------------------------------- ****************** End of data ****************************************
    620 pointsBadges:
    report
  • svankipu
    and Tom, Iam facing this error when writing the Msg Subfile Ctlfmt.(i.e. WRITEMSGCTL) - Svanky
    620 pointsBadges:
    report
  • bvining
    I have a presentation titled "Working with Messages 101" which, among other things, demonstrates how to use a message subfile. The presentation includes complete examples with all of the DDS, RPG, and message source provided. If you would like a copy send me an email at bvining@brucevining.com Bruce Vining
    6,495 pointsBadges:
    report
  • Splat
    I don't see the [b]sfile[/b] in your workstation file specification.
    7,235 pointsBadges:
    report
  • TomLiotta
    The message subfile DDS is needed to be more sure about what's happening in the program to get the error. However, there are things that don't look right. . First, I can't see where you put anything into the SFLPGMQ field. Without the DDS I don't know what it's field name is, so it might be there somewhere. . Then I don't see where MHSTAK gets a valid value. It seems to be a CHAR (4) variable, but that's wrong. It should be 10I 0 to be an integer value. As a 4-byte character field initialized to blanks, it's going to be pointing to the call stack entry that's 1077952576 entries above the current program's position in the stack. That would be a VERY deep call stack. It could explain why the API can't find the correct call stack entry. (A CHAR (4) field that contains blanks will have a hex value of x'40404040'. As a 32-bit integer, that's a decimal value of 1077952576.) Unfortunately, you're coding in RPG III for some unknown reason; so you'll need to work out a useful way to get the correct binary value into that parm. RPG III doesn't really have a correct data type. . And it's not important, but ERRLEN really should also be 10I 0 and not a 'B' data type. It doesn't make a difference here since a value of zero is the same either way, but it can make a difference under some circumstances. A good Rule Of Thumb is to never use data type 'B' unless you know why it needs to be done. (And that should probably never happen.) . Finally, is there any chance you can turn this into reasonably modern code instead of using RPG III? Why would you want to code a new program in a language that's at least 20 years out of date? Much of the code is effectively obsolete. You are trying to get help for a language that the rest of us are trying to forget. It was great 30 years ago, but it should be left behind. . Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following