|
Chris wrote: >Shouldn't the following code send a >message to my screen? The message >appears on the joblog when I look at >dspjoblog/detailed messages, but not >on the screen... > >Eval MsgTxt = "The message I want to send" >reset KeyVal >callp SndPgmMsg('CPF9898': > 'QCPFMSG *LIBL ': > MsgTxt: > %Len(MsgTxt): > '*INFO': > '*': > 1: > KeyVal: > dsEC) > >No error occurs in the program or procedure. > >"The message I want to send" never appears on screen. > >"The message I want to send" does appear in >dspjoblog/detailed messages. > >Is my prototype wrong? Is my call stack >entry wrong? The prototype seems okay. The way I debug these issues is to put the caller into debug and step to the callp SndPgmMsg. Then system request-3 and look at the stack. I don't directly prototype QMHSNDPM, rather my subprocedure does a CALL. The reason for that is because I'd rather not pass all the OS stuff into the call; just the message. I use call level 3 instead of 1. This program returns a message to the caller (in this case, the command line.) The intent is: CALL MCHINFO callp SNDMSG CALL QMHSNDPM Here's the stack whilst running: Program Rqs or Lvl Procedure Library QCMD QSYS QUICMENU QSYS 1 QUIMNDRV QSYS 2 QUIMGFLW QSYS 3 QUICMD QSYS S BUCK 4 QCMD QSYS QUOCPP QPDA QUOMAIN QPDA 5 QUOCMD QSYS < EP_MCHINFO BUCK MCHINFO BUCK SNDMSG BUCK ... Another thing to look at is the actual message in the job log. F1 on it, then F9 and see what program it was sent to. Mine looks like this: >From program . . . . . . . . . : MCHINFO From library . . . . . . . . : BUCK From module . . . . . . . . : MCHINFO From procedure . . . . . . . : SNDMSG From statement . . . . . . . : 140 To program . . . . . . . . . . : QUOCMD To library . . . . . . . . . : QSYS Instruction . . . . . . . . : 01E1 Finally, is the intended recipient listening for a message? The command line does, but a user-written program needs a subfile message queue defined in order to display the message - it won't automatically appear. --buck "Thousands of geniuses live and die undiscovered -- either by themselves or by others." -Mark Twain
As an Amazon Associate we earn from qualifying purchases.
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.