|
This is what I normally do to get around this problem:
Let say you DDS has below as the PGM message Queue.
A PGMQ SFLPGMQ(10)
In the *INZSR and assume thisProgram is the program name.
eval PGMQ = thisProgram
- Before sending the message intialize the message to the program name
eval msgQueue = thisProgram
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Holden Tommy
Sent: Tuesday, July 11, 2006 3:07 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Subprocedure question
Because with subprocs, the error messages are at a different call level.
Subroutines do not add call stack entries. I like to think of
subprocedures as "mini-programs" since they can have their own
variables, returns, parameters & call stack entries. So when using
subprocs as below you have to send the message up one more level in the
call stack for you to utilize the message in your subfile...
Thanks,
Tommy Holden
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bruce Collins
Sent: Tuesday, July 11, 2006 2:53 PM
To: RPG programming on the AS400 / iSeries
Subject: Subprocedure question
I have a dilemma and I know that one of you can help me out. For the
simplicity sake lets say I have a section of code and three sub
procedures that took the place of subroutines and now my message subfile
does not work.
Nothing else has change except for making the subroutines.
Please lets not get into why I changed them but why it is not working.
Below is a snippet of code from the program.
Through debug I can watch it perform the sndmsg but when the format is
displayed now error message is displayed.
I tried it with Subroutines and it works.
WHY????
Thanks Guys.
d******************************************************************
d msgid s 7a
d msgloc s 20a inz('FRX001A *LIBL ')
d msgRplDta s 20a inz(' ')
d msgRplDtaLen s 10i 0 inz(0)
d msgType s 10a inz('*DIAG')
d msgQueue s 276a inz('*')
d msgCallStack s 4b 0 inz(0)
d msgKey s 4a inz(' ')
d msgErr s 4b 0 inz(0)
d msgRmv s 10a inz('*ALL')
d*************************************
d* Send Messages to Message Queue
d*************************************
D SendMsg pr ExtPgm('QMHSNDPM')
D msgid 7a
d msgloc 20a
d msgRplDta 20a
d msgRplDtaLen 10i 0
d msgType 10a
d msgQueue 276a
d msgCallStack 4b 0
d msgKey 4a
d msgErr 4b 0
d*************************************
d* Remove Messages
d*************************************
D ReceiveMsg pr ExtPgm('QMHRMVPM')
d msgQueue 276a
d msgCallStack 4b 0
d msgKey 4a
d msgRmv 10a
d msgErr 4b 0
D SndMsg PR
D RcvMsg PR
D Main PR
/free
Main();
*inlr = *on;
/end-free
p Main e
/free
msgid = 'PK00001';
SndMsg();
write msgctl; // Message Subfile
exfmt pkd00201;
/end-free
p Main e
p SndMsg b
/free
Callp SendMsg(msgid:msgLoc:msgRplDta:msgRplDtaLen:
msgType:msgQueue:msgCallStack:msgKey:msgErr);
/end-free
p SndMsg e
//
******************************************************************
// * Receive Message to Subfile Routine
//
******************************************************************
p RcvMsg b
/free
Callp
ReceiveMsg(msgQueue:msgCallStack:msgKey:msgRmv:msgErr);
/end-free
p RcvMsg e
Bruce "Hoss" Collins
IBM Certified Specialist - eServer i5 iSeries System Administrator V5R3
Cisco Certified Network Associate AAA Cooper Transportation Dothan, AL
36303
(334)793-2284 x2434
--
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,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.