× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You don't need to include the procedure name. Here is my send message
subroutine. I also have a text version, but you should be able to modify
this appropriately if you want that.



// ----------------------------------------
// SndDspfMsg - sends an *INFO message to the
// message subfile in a display file.
//
// Parameters:
// StackEntry - The program call stack entry to which the message
is sent.
// Usually the program name. This must be the same
value that
// is placed in the SFLPGMQ variable in the message
subfile
// control format.
// MsgId - The Message ID from message file JCMSGF to be sent to
the program
// message Queue.
// MsgDta - (optional) Data to be used by the message to provide
dynamic
// message content. Defaults to blank.
// MsgDtaLen - (optional) The length of the message data provided
above.
// This parameter is required if MsgDta is provided.
Defaults
// to zero. If this is not provided or is zero, MsgDta
is ignored.
// ----------------------------------------
dcl-proc SndDspfMsg Export;
dcl-pi *n;
StkEnt Char(10) Const;
MsgId Char(7) Const;
MsgDta Char(512) Const Options(*VarSize: *NoPass);
MsgDtaLen Int(10) Const Options(*NoPass);
end-pi;

dcl-ds MsgFile LikeDs(QualName_t) Inz(*LikeDs);
dcl-ds ErrorCd LikeDs(ErrorCdType1_t) Inz(*LikeDs);

dcl-s pmMsgDta Char(512) Inz('');
dcl-s pmMsgDtaLen Int(10) Inz(0);
dcl-s pmMsgTyp Char(10) Inz('*INFO');
dcl-s pmStkCnt Int(10) Inz(0);
dcl-s pmMsgKey Char(4) Inz('');

// Handle *NoPass Parms
if %parms() >= %parmnum(MsgDtaLen);
pmMsgDtaLen = MsgDtaLen;
endif;

// if Message Data is provided,
if pmMsgDtaLen > 0;
pmMsgDtaLen = min(%size(pmMsgDta): pmMsgDtaLen);
pmMsgDta = %subst(MsgDta: 1: pmMsgDtaLen);
endif;

MsgFile.Name = 'JCMSGF';
qmhsndpm(MsgId: MsgFile: pmMsgDta: pmMsgDtaLen:
pmMsgTyp: StkEnt: pmStkCnt: pmMsgKey:
ErrorCd);
end-proc;

Note I am not passing much of anything to the procedure, just the stack
entry (the value that is put into SFLPGMQ), the message ID, and the message
data if necessary.

Works great. I prefer the message subfile to DDS error keywords because
they don't lock the keyboard.

On Thu, Mar 29, 2018 at 12:50 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

You need to include the procedure name.

If you are interested, I have a service program that encapsulates the
functions to do message subfiles instead of putting the code into every
program.

Please let me know if you are interested.


On Thu, Mar 29, 2018 at 7:13 AM, Paul Therrien <
paultherrien@xxxxxxxxxxxxxxxxxx> wrote:

In my programs where I have done the same thing as you are doing, the
PGMNAMQ is the main program (I set this variable value in the mainline
of the program with the *PROC value of the Program Status Data
Structure.) And I set the SND_StkCnt = 0.

So when the sendmessage sub proc runs it is pointing the the call stack
entry of the main program and the relative stack count of the message
queue is 0 (i.e. the message queue of the main program).

Paul

On 2018-03-29 09:24, Jay Vaughn wrote:

So I don't like these, but thats a different story.

I am required to put them in my interactive pgm.

Other developers write the following call to the SendMessage in their
interactive pgm using a subroutine.
I like procedures, so I put mine in a procedure. This is the ONLY
thing
i
can see different between theirs and mine, but mine will NOT display
the
message in the msg subfile at the bottom of the screen. If you view
the
joblog, you see it there.
The snd_stkCnt is being set to 0, and I suspect this is what is
tripping
me
up. Due to the fact that it is in a procedure ("mini pgm") instead of
a
subroutine, the stack count is wrong. I tried setting to 1 with no
luck.

Can anyone shed some light on this?

D SendMessage PR ExtPgm('QMHSNDPM')
D Snd_MsgId 7A
D Snd_MsgFil 20A
D Snd_Data 80A
D Snd_DtaLen 8B 0
D Snd_Type 10A
D PGMNAMQ 10A
D Snd_StkCnt 8B 0
D Snd_MsgKey 4A
D Error_Code 116A

and yes, the Program Name Que in the DSPF for the msgsfl is being set
to
the program name of my interactive pgm... does this need to be taken
one
step further and name the procedure name instead?
how would i do that?
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

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.