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



I'll take a look at this all tonight.

--
Mike Wills
http://mikewills.me


On Fri, Jan 6, 2012 at 2:40 AM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>wrote:

As Chuck, I assume the 2-byte length attribute is invalid.
Did you initialize the data structures (Keyword INZ) when defining them?
If not the 2-byte length attribute contains Blanks before moving a value
into the varying length field.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Im
Auftrag von CRPence
Gesendet: Friday, 06. January 2012 07:21
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: VarChar to Char Field, Shouldn't This Work?

On 05-Jan-2012 20:25 , Mike Wills wrote:
I have a RPG field defined as VarChar(17) and a file field defined as
Char(17). I thought I could do an eval on the two and it would work.

EDI850_Detail_Out.UnitPrice = EDI850_PO1_Record.UnitPrice

In the above, PO1 is the varchar field. I am getting the following
error: "Length of varying length variable is out of range."

Am I forgetting something? My head has been stuck in the .NET world a
bit too long me thinks....

I believe the error [rnq0115 rnx0115] implies that the 2-byte length
attribute of the varying character variable is in error already, rather
than any relationship to the ability to assign between fixed-length char
and varying-length char. If so, the question is how did that variable
with the incorrect length get set? Review the value in debug before
that assignment is attempted. Knowing what is the incorrect value for
the length may assist to track back to the assignment or other origin
[e.g. initialization, basing pointer being set, etc.] for the length
attribute of that variable.

A varying 17 takes 19 bytes of storage. If the value of the string
is 'ABC' then the storage is x'0003C1C2C3'; i.e. a length attribute of
x'00003'.

. . . . + . . . . 1 . . . . + . . . . 2
0003C1C2C3............................

However if, for example, the raw value x'C1C2C3' either had been
/moved/ into the varying field or is defined by an overlay\direct-map,
then the variable would look like the string 'C.....' with a length
attribute of x'C1C2' which is out-of-range; i.e. a length _way beyond_ 17.

. . . . + . . . . 1 . . . . + . . . . 2
C1C2C3............................

Regards, Chuck
--
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 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.