Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: BDS - Genero Migration - Use Of Edit Masks In Arithmetic  (Read 9407 times)
Stephen T.
Posts: 114


« on: October 25, 2013, 02:22:36 pm »

BDS - 3.55.01.40 (driver dbmmsv80) Genero 2.40.03 (driver dbmsncA0)

This issue is a bit odd and very obscure, as I am not sure why the code was written like this in the first place. My first thoughts were that it was a method to discount signs. I am also not sure whether this is a migration issue either. When this originally occurred, it may well have been that the order of data difference between BDS and Genero gave me a misunderstanding of what I thought I saw.
The issue was with a piece of code along the lines of:
-- Negative and mask.....
    LET l_total     = 1000
    FOR l_i = 1 TO 100
        LET l_time      = TIME
        LET l_value     = (l_time[4,5] + l_time[7,8]/100) * -1
        LET l_total     = l_total + l_value USING '##&.&&'
        DISPLAY 'Value Is (',l_value,') Total Is Now (',l_total,')'
        LET l_value     = -1
        LET l_total     = l_total + l_value USING '##&.&&'
        DISPLAY 'Value Is (',l_value,') Total Is Now (',l_total,')'
    END FOR


IE the code used an edit mask in the addition - but 'value' could and did in some cases contain -ve values. What appears now to occur, is if total - value >= 0, value is deducted from total correctly. See this output:
Value Is ( -58.13) Total Is Now (    941.87)
Value Is (  -1.00) Total Is Now (    940.87)
Value Is ( -58.13) Total Is Now (    882.74)
.....
Value Is ( -58.13) Total Is Now (    114.05)
Value Is (  -1.00) Total Is Now (    113.05)
Value Is ( -58.13) Total Is Now (     54.92)
Value Is (  -1.00) Total Is Now (     53.92)
Value Is ( -58.13) Total Is Now (      4.21)
Value Is (  -1.00) Total Is Now (      3.21)
Value Is ( -58.13) Total Is Now (     54.92)
Value Is (  -1.00) Total Is Now (     53.92)
Value Is ( -58.13) Total Is Now (      4.21)
Value Is (  -1.00) Total Is Now (      3.21)
.....

As you can see, as soon as the total - value < 0, then total assumes +ve.

I thought I saw something different with Genero, as I thought I saw that Genero ignored the sign of value in all cases - ie the mask did cause the sign to be lost.  But I think my perception was influenced by the order of the data, as it has been seen here that BDS and Genero returns data in different orders (presumably the access to the data is influenced by optimisers, drivers etc) that has also in itself caused issues (where data was being expected in a certain order without an explicit ordering statement). So what I now think was that the total figure was different before the -ve value was applied between BDS and Genero and that in practice both BDS and Genero are handling the use of the edit mask in the same way.


Nuno G.
Posts: 38


« Reply #1 on: October 25, 2013, 05:25:50 pm »

Use instead --&.&&
Hih
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines