|
Use copybooks. Look at the testbed code. We use standard names for the QMHSNDPM parameters defined in a copybook. We call the API by including the approprate copybook in line, then you have the correct procedure, and within a few statements the correct statement sent with the message, all with one line of code in the source "/Include QRpgCbSrc,CQMhSndPm". >From a previous email on a user condition handler. These are the copybooks: http://code.midrange.com/index.php?id=0c09a304c2 DQUSEC http://code.midrange.com/index.php?id=a40b9b3f86 DQMHRCVPM http://code.midrange.com/index.php?id=1b5d8cb4e1 DQMHSNDPM http://code.midrange.com/index.php?id=a9565df204 DUSERCH http://code.midrange.com/index.php?id=bd240da5b8 ZQMHRCVPM http://code.midrange.com/index.php?id=31cc85e3a2 ZQMHSNDPM http://code.midrange.com/index.php?id=2898ff8b5e ZQUSEC http://code.midrange.com/index.php?id=b8c579c977 ZUSERCH This is the user condition handler code http://code.midrange.com/index.php?id=867b3820e8 PVRM999900 This is the example procedure. http://code.midrange.com/index.php?id=02310231c4 TESTBED Duane Christen -----Original Message----- From: Hewitt, Rory [mailto:rory.hewitt@xxxxxx] Sent: Wednesday, July 27, 2005 6:30 PM To: rpg400-l@xxxxxxxxxxxx Subject: Trials and tribulations of QMHSNDPM (Was: No Subroutines...) John, Bob, et.al, >> And yes.. yes... I understand that QMHSNDPM can be wrapped in a >> sub-procedure. I've done it and have one in my toolkit. But I don't use it >> often because in most cases I want the message to contain the correct >> originating procedure/module name. As soon as you wrap QMHSNDPM in a service >> pgm subprocedure, you lose that information. What's the problem with wrapping QMHSNDPM in a procedure which takes the name of the current procedure (and possibly a callstack level above it) as parameters, and using those to send the message. The module and owning program/srvpgm name can be retrieved from the PSDS (assuming you've coded it in your module) and that's all you really need. If you haven't coded it in your module, here is an example of mine that Scott put in his newsletter in January: http://code.midrange.com/index.php?id=9c259a573f The only downside is that there is no easy way to retrieve the name of the current procedure from within a procedure. I tend to create a constant in each procedure (always called THISPROC) which contains the name of the current procedure. Anyone got a better way to retrieve the name of the current procedure ,aside from having a SUBROUTINE to call QMHSNDPM/QMHRCVPM to get it using one of the more esoteric formats)? This is my SndPgmMsg() wrapper procedure for QMHSNDPM. Call it with e.g.: Eval rc = sndpgmmsg( 'CPF9999' : THISPROC : 2 ) http://code.midrange.com/index.php?id=931ee5ee06 Rory NOTICE: This electronic mail transmission may contain confidential information and is intended only for the person(s) named. Any use, copying or disclosure by any other person is strictly prohibited. If you have received this transmission in error, please notify the sender via e-mail.
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.