× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ever since I was a wee lad I coded for displays in subroutines. My first attempt at using subprocedures and error message subfiles fell flat on its arse. Looking through the archives I figured out that I had the call stack entry wrong; it was '*' instead of the program name.

Yesterday I made another stab at using subprocedures to send and remove error messages. Sending (QMHSNDPM) works fine; removing (QMHRMVPM) doesn't. Searched the archives again and found a reply from Rory:

<snip>
D PgmSDS SDS
D PgmNam 10A
...
C callp SndPgmMsg('CPF9897': 'QCPFMSG *LIBL':
C errTxt: wwMsgLen: '*INFO':PgmNam:
C 0: wwTheKey: dsEC);
...
C callp RmvPgmMsg(PgmNam:0:' ':'*ALL':dsEC);
</snip>

Except that I'm using a message file to get the message and the QMHSNDPM API to send the messages, the process in my program is the same (well, obviously not since mine ain't working). Here's what I have (at least what I think are the relevant parts):

D/copy qsysinc/qrpglesrc,qusec

D @msgf S 20a INZ('BANDWMSGS BNWPRINT ')
D @type S 10a INZ('*DIAG')
D @rmv S 10a INZ('*ALL')
D @key S 4a INZ(*Blanks)
D @dta S 80a



D QMHRMVPM PR EXTPGM('QMHRMVPM')
D CallStkEntry 10a CONST
D CallStkCount 10i 0 CONST
D MsgKey 4a CONST
D ToRemove 10a CONST
D ErrorCode LikeDS(QUSEC)


D $CMsg PI
/free
qmhrmvpm(@pgmq:@stk:@key:@rmv:qusec);
RETURN;

Under debug the values for the parameters are, respectively:
ARQ020 [the name of the program, taken from the Program Status Data Structure]
0
' '
*ALL


Not that my users ever make errors during entry (eyes roll back into head), but just in case I would like to remove what's in the message queue. And I would prefer to stick with subprocedures rather than subroutines.

Thanks.

Jerry C. Adams
IBM System i Programmer/Analyst
--
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.