|
I'd already tried that - no joy.
I guess that %ucs2(' ') will convert to hex 20, whereas my data field
contains hex 40 following the XML-INTO. Plus, as far as I can tell, it
shouldn't be required to convert ' ' to ucs2. Implicit conversions take
place when comparing different string data types.
My problem seems to be that prior to the XML-INTO, my data field contains
all hex 20 (which is what I would expect). After XML-INTO, even though the
XML tag doesn't exist, my data field contains all hex 40. It has been
changed, whereas the IBM documentation states that it will remain unchanged.
Seems like an IBM bug ?
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Henrik Rützou
Sent: 14 February 2012 12:38
To: RPG programming on the IBM i / System i
Subject: Re: XML-INTO allowmissing=yes unicode
The unicode hex value for blank are u'0020'
This should work
if string = %ucs2(' ');
On Tue, Feb 14, 2012 at 1:06 PM, McGovern, Sean
<Sean.McGovern@xxxxxxxxxxxx>wrote:
Any idea what I need to do to ensure the unicode data is blank (hexhttp://archive.midrange.com/rpg400-l.
20) for missing XML tags ?
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Henrik Rützou
Sent: 14 February 2012 12:02
To: RPG programming on the IBM i / System i
Subject: Re: XML-INTO allowmissing=yes unicode
Sean,
if they are defined as Unicode (UCS2 that nearly equals UTF-16) so all
fields are DBCS since UTF-8 isn't supported in RPGLE or DB2.
UTF-8 is a little special because it shares x'00'-x'7F' with ASCII -
all other characters are encoded in a 2 to 4 byte "UNIT" where UTF-16
has all characters in a fixed 2 byte representation and UTF-32 has a
fixed 4 byte representation.
So when dealing with UTF-8 it has to be converted into EBCDIC or UCS2
in order to be read in the ROGLE program and/or stored in a DB2 table.
On Tue, Feb 14, 2012 at 12:45 PM, McGovern, Sean <
Sean.McGovern@xxxxxxxxxxxx
wrote:
Henrik,?).
Yes, I realise hex 40 is blank in EBCDIC, but none of my fields are
defined as character. My fields are defined as Unicode. When I view
the hex value prior to the XML-INTO operation, the value is all 20s.
After the XML-INTO, the hex value is all 40s. But the XML-INTO is
reading into a Unicode field. Plus, the IBM documentation states
that if the XML tag is missing, and allowmissing=yes is used, the
data will be the same value as prior to the XML-INTO.
Testing for *BLANK or *BLANKS will make no difference.
Sean
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Henrik Rützou
Sent: 14 February 2012 11:37
To: RPG programming on the IBM i / System i
Subject: Re: XML-INTO allowmissing=yes unicode
You get x'40' because the UTF-8 is converted into EBCDIC where x'40'
is equalt to ASCII/UTF-8 x'20'
Try to change your test to *BLANKS
On Tue, Feb 14, 2012 at 12:24 PM, McGovern, Sean <
Sean.McGovern@xxxxxxxxxxxx
wrote:
IBM i 6.1.
I have a XML document on the IFS. CCSID is 1208.
A cut-down version of the file may be...
<?xml version="1.0" encoding="UTF-8"?> <PURCHASEORDER> <HEADER>
<HEADERNOTES> </HEADERNOTES> </HEADER> </PURCHASEORDER>
...this structure is defined as follows...
<PURCHASEORDER> <HEADER> <HEADERNOTES> <POHDRNOTE></POHDRNOTE>
</HEADERNOTES> </HEADER> </PURCHASEORDER>
In the RPGLE, this is defined as follows: -
D PO DS Qualified Inz
D Dim( POIdxMax )
D Header...
D LikeDS( Header_t )
D Header_t...
D DS Qualified
D Based( Template )
D HeaderNotes...
D LikeDS( HeaderNotes_t )
D HeaderNotes_t...
D DS Qualified
D Based( Template )
D POHdrNote...
D 50c Inz
D Dim( POHdrNteIdxMax )
read as follows...
options = 'doc=file + path=Update/member/PurchaseOrder
+ case=any + allowextra=yes
+ allowmissing=yes';
xml-into PO %xml( xmlfile : options );
When the POHdrNote data is not present in the XML, I expect the
PO(x).Header.HeaderNotes.POHdrNote(x) data field to contain blanks.
However, when I look at the hex values of the field in debug, the
hex value is all 40s (I would expect hex values of all 20s for
unicode
http://archive.midrange.com/rpg400-l.When I test in the program whether the data is *Blank, the test
gives me the wrong result.
Why am I getting hex value of 40s rather than 20s when the data
tags are missing from the XML ?
Thanks.
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.