× 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.



Here is what we use for the prototype to 'QMHMOVPM'.

The "Message Type Count" field is defined as an Int, yours is defined as an Unsigned Int.
Also the 6th parm is an Error DS based on QSYSINC/QRPGLESRC,QUSEC.
Your prototype has it defined as a char 1, which isn't even large enough to contain the first 4byte Integer for size.


//*****************************
// Move message API prototype *
//*****************************
Dcl-Pr APIQMHMOVPM EXTPGM('QMHMOVPM'); // Move message API.
PR_MsgKey Char(4) CONST; // Message Key.
PR_MsgTyp Char(40) CONST OPTIONS(*VARSIZE); // Message types.
PR_MsgTypCnt Int(10) CONST; // Message type coun
PR_PgmQ Char(256) OPTIONS(*VARSIZE) CONST; // Message queue.
PR_MsgLvl Int(10) CONST; // Message level.
PR_APIErr LIKE(APIErr) OPTIONS(*VARSIZE); // API error info.
PR_PgmQLen Int(10) CONST OPTIONS(*NOPASS); // Length of PgmQ.
PR_PgmQQ Char(20) CONST OPTIONS(*NOPASS); // PgmQ qualifier.
PR_PgmQTyp Char(10) CONST OPTIONS(*NOPASS); // PgmQ type *CHAR/*
PR_FrmPgmQ Char(16) CONST OPTIONS(*NOPASS); // From pgm queue/pt
PR_FrmMsgLvl Int(10) CONST OPTIONS(*NOPASS); // From Message leve
End-Pr;

//*************************************************************************
// APIErrDef Standard API error handling structure. *
//*************************************************************************
/COPY QSYSINC/QRPGLESRC,QUSEC
Dcl-Ds APIErr; // Error structure.
APIErrPrv LIKE(QUSBPRV) INZ(%LEN(APIErr)); // Bytes provided.
APIErrAva LIKE(QUSBAVL); // Bytes available.
APIErrMsg LIKE(QUSEI); // Return message ID
APIErrRes LIKE(QUSERVED); // Reserved area.
APIErrDta Char(240); // Error message dat
End-Ds;



You can find most prototypes in David Morris's iSeries Tool Kit on source forge.

https://sourceforge.net/projects/iseries-toolkit/


Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Joep Beckeringh via RPG400-L
Sent: Tuesday, November 9, 2021 1:11 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Cc: Joep Beckeringh <joep.beckeringh@xxxxxxxxxx>
Subject: Strange error on calling API QMHMOVPM


Hello all,



I've got the following strange situation:



In a procedure in a program I call a few things and in the end I want to

move messages that I received to the calling procedure, that uses a

display file with a message subfile. So I call API QMHMOVPM, but that

reports error CPF24A5 'Value of &1, for number of message types, not

valid.'. Message data is X'00000003', which looks like a 4 byte integer

containing the value 3, like it should.



Funny thing is, I have exactly the same call in several other programs

and they don't give an error (I checked in debug).



The prototype for the call is in an include member and looks like this:



// Move program messages

dcl-pr QMHMOVPM extpgm;

MsgKey char(4) const;

MsgTyp char(40) const options(*varsize);

MsgTypCnt uns(10) const;

CstEnt char(10) const;

CstCnt uns(10) const;

ErrDts char(1) options(*varsize);

end-pr;



And the call looks like this:



// Move program messages

QMHMOVPM(MsgKey: MsgInf: MsgCnt: '*': 1: ErrDts);



MsgKey is char(4), MsgInf char(30) and contains '*COMP *DIAG *INFO',

MsgCnt = uns(10) and contains 3.



Only special thing about this program is that the calling procedure is

recursive (the program is an IFS browser; if you choose a directory it

starts a new instance of the procedure). But I fail to see how that

influences the call to QMHMOVPM.



Anyone any bright ideas about this?



Joep Beckeringh

Pantheon Automatisering

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.