IBM Support

RNX0351 Error Code 27 When RPG ILE XML-INTO Parsers XML Data With an & (Ampersand) Sign

Troubleshooting


Problem

This document explains how you would get a RNX0351 error code 27 when running a ILE RPG program doing a XML-INTO when the XML data has an & (ampersand) sign and how to resolve it.

Resolving The Problem

Disclaimer: This is an example only. IBM accepts no responsibility for its correctness.

 

The following program and xml data will end in an RNX0351 error code 27.

RPGLE program called XMLINTOEX:
**FREE
Dcl-Ds Row1;
  VendName        Char(30);
End-Ds;
XML-INTO Row1 %XML('/home/TESTXML.xml' :
'doc=file case=any');
*INLR = '1';   

You should use Notepad to create the XML document which is called TESTXML.xml. The document was saved in the directory /home:

<Row1>
<VendName>A & L TRUCKING</VendName>
</Row1>

After you run it, you will get the following message:

Message ID . . . . . . :   RNX0351       Severity . . . . . . . :   50      
Message type . . . . . :   Escape                                            
Date sent  . . . . . . :   03/25/09      Time sent  . . . . . . :   13:27:46
                                                                           
Message . . . . :   The XML parser detected error code 27.                  
Cause . . . . . :   While parsing an XML document for an RPG procedure, the  
 parser detected an error at offset 27 with reason code 27. The actual      
 document is /home/TESTXML.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.                                        


You will also see the following if you answer the message with an F for full formatted dump:

ILE RPG FORMATTED DUMP
ROW1 DS
VENDNAME CHAR(30) ' '
VALUE IN HEX '404040404040404040404040404040404040404040404040404040404040'X

To resolve, you must change the XML data to the following. Note: If you need an & (ampersand) in your XML data, you must type a &amp; each time.

<Row1>
<VendName>A &amp; L TRUCKING</VendName>
</Row1>

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

519407591

Document Information

Modified date:
15 November 2024

UID

nas8N1013060