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



Joe,

Thanks for the explanation. I was confused by a few things.

1. The positions... "one-based" is new to me.
2. The "replacement data"... this doesn't look very useful to me

The IBM documentation is (IMHO) confusing when it comes to defining these data structures .

So my difficulty was finding/locating the beginning of the Message data. Instead of using a pointer, I simply copied in the DS as defined in the IBM source member and added on a message field.

Given my DS below (IBM's QMHM020000 + char 3000), I found the Message data this way:

ErrorMsg = %subst(Error.Message : Error.RCVM0200.QMHLDRTN00 + 1);

I think my code will always get the Message Data... So now I'm wondering if there is a better method to define my DS (Error) than how I have it below?

(this is from debug)
ERROR
RCVM0200
QMHBRTN02 = 2565
QMHBAVL03 = 2565
QMHMS06 = 50
QMHMI04 = RNX0353
QMHMT05 = 15
QMHMK04 = VT&
QMHMFILN02 = QRNXMSG
QMHMFILL00 = *LIBL
QMHMLIBU00 = QSYS
QMHSJ00 =
QMHSUP00 =
QMHSJNBR00 =
QMHSPGMN00 = QRNXUTIL
QMHSINBR00 = 0000
QMHSD04 = 1190730
QMHST03 = 162713
QMHRPGMN00 = PD000N
QMHRINBR00 = 0000
QMHST04 = 1
QMHRT00 = 1
QMHERVED13 =
QMHSIDCS03 = 1
QMHSIDCS04 = 2
QMHAO00 = *NO
QMHCSIDR03 = 65535
QMHCSIDR04 = 65535
QMHLDRTN00 = 125
QMHLDAVL00 = 125
QMHLMRTN00 = 64
QMHLMAVL00 = 64
QMHLHRTN00 = 2200
QMHLHAVL00 = 2200
MESSAGE = œ hdr hdr(14).shiptomethod ádoc=file case=any allowextra=yes countprefix=count_ path=orders/order /gwilburn/bad.xmlThe XML document does not match the RPG variable; reason code 4.Cause . . . . . : While parsing an XML document, the parser found that the XML document does not correspond to RPG variable "hdr" and the options do not allow for this. The reason code is 4. The exact subfield for which the error was detected is "hdr(14).shiptomethod". The options are "doc=file case=any allowextra=yes countprefix=count_ path=orders/order". The XML document name is /gwilburn/bad.xml; *N indicates that the XML document was not an external file. Recovery . . . : Contact the person responsible for program maintenance to determine the cause of the problem. Technical description . . . . . . . . : Reason codes and their meanings are as follows: 1. The specified path to the XML element was not found in the XML document. 2. The XML document contains too few array elements for array subfields of a data structu


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Joe Pluta
Sent: Wednesday, July 31, 2019 8:52 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: RNX0356 Document for DATA-INTO does not match RPG Variable

Greg, I haven't worked with this one specifically, but I've worked with a lot of IBM structures with variable length data.  If this one follows the normal pattern, it would work something like this:

1. Data starts AFTER the last fixed-length field 2. In this case, the last fixed-length field is QMHLHAVL 3. The positions are from 173 to 176 4. And so the first variable length field starts at position 177

Since data structure positions are one-based, the offset of the first field is actually 176.  The rest of the calculations are made using the returned lengths, QMHLDRTN, QMHLMRTN, and QMHLHRTN.  So if I start with a pointer pData whose value is %addr(myDS), then I get this:

Replacement data starts at (pData + 176) for QMHLDRTN bytes Message data starts at (pData + 176 + QMHLDRTN) for QMHLMRTN bytes Help starts at (pData + 176 + QMHLDRTN + QMHLMRTN) for QMHLHRTN bytes

Is this not what you're seeing?



On 7/30/2019 3:38 PM, Greg Wilburn wrote:
These Data Structures suck...

So I added a message field of my own to the end of the DS:

/include qsysinc/qrpglesrc,qmhrtvm // QMHRTVM API data structures

dcl-ds Error qualified;
rcvm0200 likeds(QMHM020000);
Message char(3000);
end-ds;

The DS field QMHLDRTN00 has a description (in the /include) of " Length Data Returned"

Through trial and error I discovered that this value is the length of the first part of the message... The actual Message and Cause from the job log BEGIN at one position beyond that (QMHLDRTN00 + 1).

Has anyone worked with these enough to confirm this? It just doesn’t make sense to me given the IBM field description in the source file and online.

Greg

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

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.