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