Edit Mask Query

Can someone please assist a very tired and confused ex-programmers mind please

Why does Edit mask statement 1 work ignoring the pipe delimeter, but drop the decimal value?
Why does edit mask statement 2 fail with input dos not correspond to edit mask?

[color=“blue”]

DEFINE DATA LOCAL
1 #IN-PRICE (A12) INIT<'      5.99| '>
1 #IN-PRICE-2 (A12) INIT<'        5.99'>
1 #PRICE-PKD (P5.2)
END-DEFINE
*
MOVE EDITED #IN-PRICE TO #PRICE-PKD (EM=ZZZZ9.99)
PRINT '=' #IN-PRICE '=' #PRICE-PKD
(Result - #IN-PRICE is 5.99,   #PRICE-PKD is 5.00)

MOVE EDITED #IN-PRICE-2 TO #PRICE-PKD (EM=ZZZZ9.99)
PRINT '=' #IN-PRICE-2 '=' #PRICE-PKD
*
END

[/color]

Thanks all

Hi Alexman

(hope you will be less mad after reading my answer :slight_smile:

I think in your first MOVE EDITED you`re asking NATURAL to interpret
the first 7 chars of your #IN-PRICE as Z(4)9.99; so, it (NATURAL) may see only the integer 5 (please verify that, if you have any doubts)

As for your second MOVE, the first 7 chars of your #IN-PRICE look as BLANK; according to NATURAL (I’d agree with it), it is NOT a Z(4)9.99 since there`s no any digits among the first 7 chars.

Try this in place, and you will get 5.00 again after your second MOVE
1 #IN-PRICE-2 (A12) INIT<’ 5.99’>

Hi Nikulay
Thanks for taking the time to reply. You have confirmed the thoughts of one of my learned colleagues here. We are now putting more robust valdation in place to solve this issue.
Many thanks once again :slight_smile:

No problem.
Sorry for misspelling your name :-); I`m also taking this opportunity to thank you since I’ve never heard before about “the mad Axeman”; tonight I’ll try to listen about your attack (by the Michael Schenker Group) :slight_smile:

Any way try don`t attack me nor get mad at me please :slight_smile:
Nikolay

Check out the VAL function - it may work better for you:

IF #IN-PRICE IS (P5.2)
   #PRICE-PKD := VAL(#IN-PRICE)
END-IF