Skip to Content
author's profile photo Former Member
Former Member

why do casts from char to packed fields fail?

hello there,

i try to assign a quite small value ('-9.123E-123') from a character(255) field into a field type p. but although the string is a number i get a CX_SY_CONVERSION_NO_NUMBER exception. only if i move the value into a float field first the typeconversion works.

data: var1(255) type c value '-9.123E-123',

var2 type f,

var3(7) type p decimals 2.


var3 = var2 = var1. => works fine

Does anybody know why the types aren't converted correctly and were i can get some additional documentation? the character field is also used for other not number like values and i do not want to use a lot of RTTI to determine the type of the field i assign the value to in my program.

thanks in advance


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2004 at 01:07 PM

    Packed variables will only allow conversion from character strings like "1234.56-", not even "1,234.56-".

    Your value is not a packed number but rather a float. This is why the conversion to packed must go char -> float -> packed, accepting possible truncation and rounding along the way.

    Most type-conversion documentation can be accessed by looking at the help for the MOVE command.


    Message was edited by: Scott Barden

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.