× 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.





Bob,

It is not the procedure that includes the EXFMT that you must use for
sending your messages to, because the Display() procedure is not on the
call stack when you are in ValidInput() or FunctionKeyPressed(). You need
to use a procedure, that is always on the call stack.

For your example you could use the procedure that controls the program flow
and which calls Display(), ValidInput() and FunctionKeyPressed().

For example, if the name of your main procedure is 'main', then set SLPGMQ
on the message subfile to 'main' and send your messages to procedure main
like this:

QMHSNDPM(msgId: qMsgFName: msgData: %len(msgData): msgType
: 'main': 0: msgKey: errorCode)

I am not sure what happens if you have multiple 'main' procedures on the
call stack.

But you could make your main procedure unique like this:

P main pr extproc('ModuleName_main')

Then use QMHSNDPM like this:

QMHSNDPM(msgId: qMsgFName: msgData: %len(msgData): msgType
: 'ModuleName_main': 0: msgKey: errorCode)

That works as long as you do not bind your module to multiple programs.

Thomas.


Am 24.04.2015 um 22:44 schrieb Bob Cagle:
Alan

I did try that - using the procedure name that includes the Exfmt, but I still got that 'call stack entry can't be found' error and no messages displayed.

Thanks

Bob Cagle
IT Manager
Lynk, Inc.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces-Zwy7GipZuJhWk0Htik3J/w@xxxxxxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Friday, April 24, 2015 2:36 PM
To: RPG programming on the IBM i / System
Subject: Re: Interactive screen logic, Message subfiles, and the program stack

Bob I would go back to my code. Note my code for displaying subfiles messages. The service program XVMSGS handles it correctly. You have to give it the program name, module name and the main procedure. Whatever procedure has the exfmt would be the procedure name.
On Apr 24, 2015 12:15 PM, "Bob Cagle" <bcagle-1/Z/dJ/1MFBBDgjK7y7TUQ@xxxxxxxxxxxxxxxx> wrote:

It seems this subject has been discussed ad-nauseam, but yes, this again:

I recently converted my messaging routines to service programs and
switched to using sub-procedures vs subroutines and was having trouble
getting the everything to work.

With the help of older posts here on the list and some others examples
(thanks Alan Campin and your Trigger Mediator code), I finally got
everything working.

Now I'm just trying to understand something, hope I explain this well
enough:

I have a module with a 'ProcessScreen' procedure that is just
controlling the flow and calls subprocedures for everything, like so:


Dcl-proc ProcessScreen;

Init();

DOU Key = F3:
Display();
IF Not FunctionKeyPressed();

IF ValidInput();
Process();
ENDIF;
ENDIF;
ENDDO;

End-proc;


Obviously, the screen logic is buried in the Display() subprocedure:

Dcl-proc Display;
Write MSGCTL01;
Exfmt SC01;
MSG_Clear( Procedure:Module:Program ); End-proc;


Error messages are thrown in both the FunctionKeyPressed and ValidInput
subprocedures.

I manually set the Procedure variable to be 'ProcessScreen' and pull the
module and program names from the program status data structure. And I set
the SLPGMQ on the message subfile to '*'.

What I have found with this structure is that even though the messages
show in the joblog, they will not display in the message subfile.

But when I get rid of the Display() subprocedure and move the display
logic to ProcessScreen, voila, it works.

Pretty sure this has to do with the program stack. How would I make the
message subfile work with the display logic in a 'sub' subprocedure? I did
try changing the procedure variable to 'Display', but received the 'call
stack entry not found' error.

So what's the answer here - am I just stuck with the having the display
logic in the top-level procedure? Not that it's that big a deal, but it's
annoying not being able to figure this out.

Thanks

Bob Cagle
IT Manager
Lynk, Inc.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.