|
Tom,
Here is a set of templates I use for message subfiles.
I paste this source into my display file.
DDS Source
A R MSGSFL SFL SFLMSGRCD(24)
A MSGKEY SFLMSGKEY
A MSGPGMQ SFLPGMQ(10)
A R MSGCTL SFLCTL(MSGSFL)
A SFLDSP
A SFLDSPCTL
A SFLSIZ(2)
A SFLPAG(1)
A N03 SFLEND
A SFLINZ
A MSGPGMQ SFLPGMQ(10)
RPG D Spec. I include a /copy compiler directive to this code in my D spec
in the source that contains the Display file.
D/copy *libl/qrpglesrc,msghndd
?
********************************************************************************
? * In the MSGF field, place the name of the message file your program
is *
? * using.
*
? * The coorisponding display file for this snippet is
MWLIB/QDDSSRC(MSGHND) *
? * The subfile message control record is MSGCTL.
*
? *
? * Message Handling API Data Items.
? *
Dstkcnt S 9b 0
Ddtalen S 9b 0 INZ(80)
Derrcod s 9b 0
Dmsgf s 20 INZ('MESSAGE *LIBL ')
Dmsglib s 10 INZ('*LIBL')
Dmsgky s 4 INZ(*blanks)
Dmsgdta S 80 INZ(*blanks)
Dmsgtyp S 10 INZ('*DIAG')
Dmsgrmv S 10 INZ('*ALL')
Dmsgid S 7 INZ(*blanks)
RPG C Spec,
I include a /copy compiler to this code at the bottom of the C spec in the
source that contains the Display file.
? *
? * Send Message API - Sends messages to the program message queue
? *
C @sndmsg begsr
c movel '*' msgpgmq
c call 'QMHSNDPM'
C parm msgid
c parm msgf
c parm msgdta
c parm dtalen
c parm msgtyp
c parm msgpgmq
c parm stkcnt
c parm msgkey
c parm errcod
c endsr
? *
? * Clear Message API - Clears the programs message queue
? *
C @clrmsg begsr
c movel '*' msgpgmq
c call 'QMHRMVPM'
c parm msgpgmq
c parm stkcnt
c parm msgky
c parm msgrmv
c parm errcod
c endsr
Then before I EXFMT a record format, I WRITE MSGCTL. and after the EXFMT I
EXSR @CLRMSG
To place an entry in the message subfile I execute code something like
this:
C EVAL msgdta = 'Invalid Customer Number.'
? C EXSR @sndmsg
or:
C EVAL msgid = 'OEI0001'
C EXSR @sndmsg
I hope this helps.
Thanks,
Mark
Mark Walter
Sr. Programmer/Analyst
Hanover Wire Cloth a div of CCX, Inc.
mwalter@hanoverwire.com
http://www.hanoverwire.com
717.637.3795 Ext.3040
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.