|
I get...
EVAL PO(1).Header.HeaderNotes.POHdrNote(1):x
00000 40404040 40404040 40404040 40404040 -
00010 40404040 40404040 40404040 40404040 -
00020 40404040 40404040 40404040 40404040 -
00030 40404040 40404040 40404040 40404040 -
00040 40404040 40404040 40404040 40404040 -
00050 40404040 40404040 40404040 40404040 -
00060 40404040 ........ ........ ........ - ............
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Henrik Rützou
Sent: 14 February 2012 15:10
To: RPG programming on the IBM i / System i
Subject: Re: XML-INTO allowmissing=yes unicode
What exactly do you get in DEBUG in eval pohdrnote:x is it 40404040
40404040 or
00400040 00400040 ?
On Tue, Feb 14, 2012 at 3:58 PM, McGovern, Sean
<Sean.McGovern@xxxxxxxxxxxx>wrote:
My mistake. This doesn't work.ASCII,
-----Original Message-----
From: McGovern, Sean
Sent: 14 February 2012 14:57
To: RPG programming on the IBM i / System i
Subject: RE: XML-INTO allowmissing=yes unicode
Thanks. This does work and provides a workaround for now.
However, I still don't understand why comparing to *Blank, *Blanks, '
', or %ucs2(' ') doesn't work as I thought that the comparison of
different string data types in now acceptable.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Henrik Rützou
Sent: 14 February 2012 13:43
To: RPG programming on the IBM i / System i
Subject: Re: XML-INTO allowmissing=yes unicode
The default for trim-constant depends on the data type of
string-expression:
- A DBCS blank if string-expression is a DBCS graphic string. For
the CCSID determines the hex value that represents a DBCS blank. Forx'40'
example, for Japanese (CCSID 301), X'8140' represents a DBCS blank,
while for Simplified Chinese, X'A1A1'represents a DBCS blank. For
EBCDIC, X'4040' represents a DBCS blank.
- A UTF-16 or UCS-2 blank (X'0020') if string-expression is a Unicode
graphic string.
- A value of X'00' if string-expression is a binary string.
- Otherwise, a single byte blank. For EBCDIC, X'40' represents a blank.
When not EBCDIC, X'20' represents a blank.
So IBM leaves it as graphic 'blanks'
Work around:
if string = u'4040' or string = u'0020';
On Tue, Feb 14, 2012 at 2:19 PM, McGovern, Sean
<Sean.McGovern@xxxxxxxxxxxx>wrote:
I'd already tried that - no joy.will remain unchanged.
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
table.
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
(hex
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
20s.
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
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
blanks.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
http://archive.midrange.com/rpg400-l.http://archive.midrange.com/rpg400-l.http://archive.midrange.com/rpg400-l.?).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
--
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.