Negative numbers don't work

Issue #17 resolved
Teemu Halmela created an issue

Negative numbers doesn't seems to work.

     H AlwNull(*UsrCtl)

       dcl-pr Main extpgm;
         aint8 int(3);
         aint16 int(5);
         aint32 int(10);
         aint64 int(20);
         afloat float(4);
         adouble float(8);
         apacked packed(12:2);
         azonded zoned(12:2);
       end-pr;

       dcl-pi Main;
         aint8 int(3);
         aint16 int(5);
         aint32 int(10);
         aint64 int(20);
         afloat float(4);
         adouble float(8);
         apacked packed(12:2);
         azonded zoned(12:2);
       end-pi;
         aint8 -= 10;
         aint16 -= 10;
         aint32 -= 10;
         aint64 -= 10;
         afloat -= 10.11;
         adouble -= 10.111;
         apacked -= 10.11;
         azonded -= 10.11;
       return;
$ ./test1000_sql400json32 ../json/j0020_negative_numbers                                                                                                       
input(5000000):                                                                                                                                                                    
{"pgm":[{"name":"NEGATIVE",  "lib":"DB2JSON"},
        {"s":[{"name":"aint8",      "type":"3i0",   "value":-1},
              {"name":"aint16",     "type":"5i0",   "value":-2},
              {"name":"aint32",     "type":"10i0",  "value":-3},
              {"name":"aint64",     "type":"20i0",  "value":-4},
              {"name":"afloat",     "type":"4f2",   "value":-5.55},
              {"name":"adouble",    "type":"8f3",   "value":-6.666},
              {"name":"apacked",    "type":"12p2",  "value":-7.77},
              {"name":"azoned",     "type":"12s2",  "value":-8.88}
             ]}
       ]}

output(167):
{"script":[{"pgm":["NEGATIVE","DB2JSON",{"aint8":-9},{"aint16":-8},{"aint32":-7},{"aint64":-6},{"afloat":-4.56},{"adouble":-3.445},{"apacked":2.34},{"azoned":1.23}]}]}

result:
fail missing ("aint8":-11)
fail (-1)

Ints and floats seem to return negatives correctly, but they seem to lose the sign when sending. Packed and zoned also won't return negative number.

Test files can be found in my fork.

Comments (3)

  1. Former user Account Deleted

    Ints and floats seem to return negatives correctly, but they seem to lose the sign when sending. Packed and zoned also won't return negative number.

    I will take a look.

    BTW -- only work Mon-Wed (part time).

  2. Former user Account Deleted

    negative

    Ok, fix available.

    • Yips Super Driver - test driver - 1.1.2-sg7 - toolkit fix negative numbers (hamela07)
    bash-4.3$ cd tests/c
    bash-4.3$ ./test1000_sql400json32 ../json/j0193_pgm_hamela07-negative    
    input(5000000):
    {"pgm":[{"name":"HAMELA07",  "lib":"DB2JSON"},
            {"s":[{"name":"aint8",      "type":"3i0",   "value":-1},
                  {"name":"aint16",     "type":"5i0",   "value":-2},
                  {"name":"aint32",     "type":"10i0",  "value":-3},
                  {"name":"aint64",     "type":"20i0",  "value":-4},
                  {"name":"afloat",     "type":"4f2",   "value":-5.55},
                  {"name":"adouble",    "type":"8f3",   "value":-6.666},
                  {"name":"apacked",    "type":"12p2",  "value":-7.77},
                  {"name":"azoned",     "type":"12s2",  "value":-8.88}
                 ]}
           ]}
    
    
    output(177):
    {"script":[{"pgm":["HAMELA07","DB2JSON",{"aint8":-11},{"aint16":-12},{"aint32":-13},{"aint64":-14},{"afloat":-15.66},{"adouble":-16.777},{"apacked":-17.88},{"azoned":-18.99}]}]}
    
    result:
    success (0)
    
  3. Log in to comment