G#AddMsg is, I'm guessing, using the QMHSNDPM API. I still use subroutines for the process you describe, but one of the parms for QMHSNDPM (I forget which one) has to do with where on the call stack or such the message is sent. Check the API documentation and modify the G#AddMsg subprocedure accordingly.
Jerry C. Adams
IBM System i Programmer/Analyst
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Smith, Mike
Sent: Wednesday, August 27, 2008 8:03 AM
Subject: Subprocedure global/local ?
I am trying to make myself use subprocedures more- rather than
subroutines. I have run into a little problem, and I'm not quite sure
what I need to do.
I have a procedure in a service program that is used for displaying
messages in display files. I use this all the time.
Now I have written a data entry program that has quite a bit of
validation. I have written another service program that has the
validation in it. Because there is a lot of validation I put all of
these within a subprocedure in my main program. Here is where the
problem occurs. My messages don't display. If I simply change the
subprocedure to a subroutine, my messages display.
C Eval PaverErr = valid_paver(cscrew)
C If PaverErr = *On
C Move 'RG1010 ' MSGID
C CallP G#AddMsgSF(MSGID:' ':
G#ADDMSGSF is in service program
Valid_paver is in a separate service program.
Checkvalid is subprocedure in main pgm
Any ideas on how to make this work.
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives