|
Good explanation. So, if you want to look at '' then it's best to replace
if string > '';
with
if %len(string)>0;
or
if string > *allX'00';
Rob Berendt
--
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: Luis Rodriguez <luisro58@xxxxxxxxx>
To: "RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
Date: 10/11/2011 10:33 AM
Subject: Re: RPG Error or ?
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
Henrik,
As I see it, it's working as designed. As per my V5R3 RPGLE Reference
manual:
If character, graphic, or UCS-2 fields are compared, fields of unequal
length are aligned to their leftmost character. The shorter field is
filled
with blanks to equal the length of the longer field so that the field
lengths are equal for comparison.
So your '' gets converted to, say, 5 chars (X'40) and, if the first
characters in "string" are x'0515' or x'4015' the are, of course, less in
"weigth" than the X'4040' it would find in the string at the right of the
'>'
Hope it makes sense :-)
Regards,
Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries
--
On Tue, Oct 11, 2011 at 9:20 AM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
Is it me that has misunderstood something or what would you expecthttp://powerext.com/>
displayed from this code:
d string s 52a varying
string = x'0515' + 'abc';
or
string = x'4015' + 'abc';
// dosn't work (but works if x'4040' + 'abc')
if string > '';
dsply 'hello 1';
endif;
// works
if string <> '';
dsply 'hello 1';
endif;
// works
if %len(string) > 0;
dsply 'hello 2';
endif;
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/> <http://powerext.com/> <
> --
This is the RPG programming on the IBM i / System i (RPG400-L) mailinglist
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.
--
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.