Need Help With QMHRCVM – Receive Nonprogram Message API

55 pts.
Tags:
API
iSeries
QMHRCVM
Need Help With QMHRCVM - Receive Nonprogram Message API.  I am having problems with the parameters (4 BYTES)  Can someone help?

D ERRORDS         DS                  INZ      D  BYTESPROV              1      4B 0 INZ(116) D  BYTESAVAL               5      8B 0          D  MESSAGEID              9     10             D  ERR###                 16     16             D  MESSAGEDTA           17    116            

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you will be writing code to use more APIs, you will want to study the Information Center API topics. In this case, one error is the use of {4B 0} in RPG to represent a parameter that is given as “Binary(4)” in the API documentation. That isn’t an appropriate way to declare a “Binary(4)” in RPG.

In the ERRORDS, you had other ‘B’ data type fields; but you specified starting and ending locations, e.g., {1 4B 0}, rather than simply specifying a size. The use of starting and ending locations ensured that 4 bytes of memory were made available. That will work with most APIs, so those can be left as they are. (I would still recommend changing them to “I” data types in order to be consistent and to help remember in the future.)

Review the <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apiref/data.htm”>Data types and APIs</a> topic in the Information Center. You should probably read that entire <i>API concepts</i> section that surrounds the Data types topic.

Tom

p.s. When you paste code, select the text after you complete the paste. Then click the {code} button at the top of the edit window. That will make your program statements much more readable.

==========================================================

Sorry my code didn’t copy over. This is the code I have for the parameters.<pre>
D DS INZ
DMSGINFO 80
DMSGINFOLENGTH 4B 0 INZ(%SIZE(MSGINFO))
DMSGFORMAT 8 INZ(‘RCVM0100′)
DMSGQUENAME 20
DMSGTYPE 10
DMSGKEY 4
DMSGWAITTIME 4B 0
DMSGACTION 10 INZ(‘*SAME’)
DMSGERROR 116
D
DRCVM0100 DS INZ
DRCVBYTESRETURN 4B 0
DRCVBYTESAVAIL 4B 0
DRCVMSGSEVERITY 4B 0
DRCVMSGID 7
DRCVMSGTYPE 2
DRCVMSGKEY 4
DRCVRESERVED 7
DRCVCCID 4 0
DRCVCCID2 4 0
DRCVRPLLENRET 4 0
DRCVRPLLENAVL 4 0
DRCVMESSAGE 10
D ERRORDS DS INZ
D BYTESPROV 1 4B 0 INZ(116)
D BYTESAVAL 5 8B 0
D MESSAGEID 9 10
D ERR### 16 16
D MESSAGEDTA 17 116
C
C *ENTRY PLIST
C PARM EPMSGQNAME 10
C PARM EPMSGQLIB 10
C PARM EPMSGTYPE 10

C
C MOVEL EPMSGQNAME MSGQUENAME
C MOVE EPMSGQLIB MSGQUENAME
C
C CALL ‘QMHRCVM’
C PARM MSGINFO
C PARM MSGINFOLENGTH
C PARM MSGFORMAT
C PARM MSGQUENAME
C PARM EPMSGTYPE MSGTYPE
C PARM MSGKEY
C PARM MSGWAITTIME
C PARM MSGACTION
C PARM ERRORDS
C
C
C EVAL *INLR = *ON</pre>

I recieve a message thid in debug:
EVAL ERRORDS
BYTESPROV OF ERRORDS = 000000116.
BYTESAVAL OF ERRORDS = 000000015.
MESSAGEID OF ERRORDS = ‘CP’
ERR### OF ERRORDS = ’0′
MESSAGEDTA OF ERRORDS =

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • jldunn
    I changed the length of one parameter: D MESSAGEID 9 15 Now I recieve message EVAL ERRORDS BYTESPROV OF ERRORDS = 000000116. BYTESAVAL OF ERRORDS = 000000015. MESSAGEID OF ERRORDS = 'CPF24B4' ERR### OF ERRORDS = '0' MESSAGEDTA OF ERRORDS =
    55 pointsBadges:
    report
  • TomLiotta
    Get rid of all of your {4B 0} field definitions and replace them with correct definitions. Use (10I 0}. Then see if anything changes. A {4B 0} field is not a Binary(4). It is a kind of binary field that allows a maximum of {4} digits and provides a way for RPG to handle decimal fractions in binary fields. The maximum value that can be stored in {4B 0} is 9999 because that's the largest 4-digit value. The "4" refers to number of digits in a RPG 'B' field. The RPG storage representation of {4B 0} is essentially a 16-bit integer field -- two bytes. The API requires 32-bit integer fields -- four bytes. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following