Change in nr of decimals, but old programs run without error

Posted by Patrick Tingen on 21-Mar-2016 03:27

TLDR; I change the number of decimals on a field, but old programs that were not recompiled still run without errors. They perform as if the database change did not happen. Is this a bug?

Step 1: preparation

My starting point is an OpenEdge 10.2B sports database with a decimal field with 2 decimals. See below a screenshot from the DataDigger:

The CRC for the "item" table is 40569:

I created a small program that sets the price of item nr 31 to 3.1415925:

/* SetPrice.p */
DEFINE BUFFER bItem FOR sports11.Item.
 
FIND bItem WHERE bItem.Item-num = 31.

ASSIGN bItem.Price = 3.1415925.

I compiled the program and renamed the .p to .txt to make sure that the .r was executed and not the .p:

I double-checked the .r file for the correct CRC value: 

RCODE-INFO:FILE-NAME = 'c:\Temp\setprice.r' .

MESSAGE RCODE-INFO:TABLE-LIST RCODE-INFO:TABLE-CRC-LIST

  VIEW-AS ALERT-BOX INFO BUTTONS OK.

Result:

The value of Item 31 before and after running:

  

So far, so good. The field has 2 decimals to the value is rounded to 2 decimals. This is correct.

Step 2: the change 

I change the definition of the price field to 10 decimals:

If I look at the CRC of the item table, I can see that it has changed - as expected:

Via the DataDigger I reset the value of the field back to 0 before testing:

 

I re-run my program without recompiling. To make sure it actually runs I check for errors: 

RUN c:\Temp\setprice.r NO-ERROR.

MESSAGE ERROR-STATUS:ERROR ERROR-STATUS:NUM-MESSAGES

  VIEW-AS ALERT-BOX INFO BUTTONS OK.

Result:

The value in the database is now:

My conclusion is that the old .r ran successfully, since I received no error and the value of the field changed from 0 to 3.14. But how could the program have runned if the CRC value is different? I would have expected an error. 

Posted by Stefan Drissen on 21-Mar-2016 03:55

All Replies

Posted by Stefan Drissen on 21-Mar-2016 03:55
Posted by Patrick Tingen on 21-Mar-2016 04:24

Okay, so it's not a bug but a feature. Interesting. Thanks for the heads up!

This thread is closed