Useless empty DS data when counter = 0

Issue #32 resolved
Brian Jerome created an issue

When a DS has a counter value of 0 it will return a bunch of blank useless data up to the dim specified. It should return an empty DS with 0 records.

You can use the same test PGM from Issue #30. The result set is too large to paste here.

Comments (9)

  1. Former user Account Deleted

    ... counter value of 0 it will return a bunch of blank useless data ...

    Ok, made a change to allow for zero count dou in ds array

    bash-4.3$ ./test1000_sql400json32 ../json/j0169_pgm_danny04-ds_dou_zero            
    input(5000000):
    {"pgm":[
        {"name":"DANNY04", "lib":"DB2JSON"},
        {"s": {"name":"inCount", "type":"10i0", "value":0, "by":"in"}},
        {"ds": [{"name":"inputDS","dim":20, "by": "in"},
            {"s":[
                {"name":"in1", "type":"100a", "value":"i1"},
                {"name":"in2", "type":"100a", "value":"i2"}
            ]}
        ]},
        {"s": {"name":"outCount", "type":"10i0"}},
        {"ds": [{"name":"outputA","dim":15000, "by": "out", "dou": "outCount"},
            {"s":[
                {"name":"o1", "type":"500a", "value":"i1"},
                {"name":"o2", "type":"500a", "value":"i2"}
            ]}
        ]},
        {"s": {"name":"last", "type":"20a", "value":"ll"}}
    ]}
    
    
    output(124):
    {"script":[{"pgm":["DANNY04","DB2JSON",
    {"outCount":0},
    {"outputA":[[{"o1":"i1"},{"o2":"i2"}]]},
    {"last":"\"quoted\" text"}]}]}
    
    result:
    success (0)
    
  2. Brian Jerome reporter

    Almost..

    I changed the JSON input to

    {"pgm":[
        {"name":"DRTEST04","lib":"BJEROME"},
        {"s": {"name":"inCount", "type":"10i0", "value":0, "by":"in"}},
        {"ds": [{"name":"inputDS","dim":20, "by": "in"},
            {"s":[
                {"name":"in1", "type":"100a", "value":"i1"},
                {"name":"in2", "type":"100a", "value":"i2"}
            ]}
        ]},
        {"s": {"name":"outCount", "type":"10i0"}},
        {"ds": [{"name":"outputA","dim":15000, "by": "out", "dou": "outCount"},
            {"s":[
                {"name":"o1", "type":"500a"},
                {"name":"o2", "type":"500a"}
            ]}
        ]},
        {"s": {"name":"last", "type":"20a", "value":"ll"}}
    ]}
    

    Still got one record in outputA:

    {"script":[{"pgm":["DRTEST04","BJEROME",{"outCount":0},{"outputA":[[{"o1":""},{"o2":""}]]},{"last":"\"quoted\" text"}]}]}
    

    I'm expecting:

    {"script":[{"pgm":["DRTEST04","BJEROME",{"outCount":0},{"outputA":[]},{"last":"\"quoted\" text"}]}]}
    
  3. Former user Account Deleted

    Ok, extra record pest has been eliminated (i think). Give a try.

    • Yips Super Driver - test driver - 1.1.4-sg12 - toolkit - try again dou value zero ds array (Danny)
    bash-4.3$ ./test4000_sql400json_procj64 ../json/j0169_pgm_danny04-ds_dou_zero
    input(5000000):
    {"pgm":[
        {"name":"DANNY04", "lib":"DB2JSON"},
        {"s": {"name":"inCount", "type":"10i0", "value":0, "by":"in"}},
        {"ds": [{"name":"inputDS","dim":20, "by": "in"},
            {"s":[
                {"name":"in1", "type":"100a", "value":"i1"},
                {"name":"in2", "type":"100a", "value":"i2"}
            ]}
        ]},
        {"s": {"name":"outCount", "type":"10i0"}},
        {"ds": [{"name":"outputA","dim":15000, "by": "out", "dou": "outCount"},
            {"s":[
                {"name":"o1", "type":"500a", "value":"i1"},
                {"name":"o2", "type":"500a", "value":"i2"}
            ]}
        ]},
        {"s": {"name":"last", "type":"20a", "value":"ll"}}
    ]}
    
    
    output(99):
    {"script":[{"pgm":["DANNY04","DB2JSON",
    {"outCount":0},
    {"outputA":[]},
    {"last":"\"quoted\" text"}]}]}
    
    result:
    success (0)
    
  4. Brian Jerome reporter

    Looks good, but can this change also be added to the experimental driver? I tried running the input with toolkitasync and it gives me all the blank data still.

  5. Former user Account Deleted

    can this change also be added to the experimental driver?

    For clarity, changes in db2sock are not directly tied to experimental node driver. Aka, db2sock is the driver for node db2ia ( under/below node db2ia).

    Works fine for me (below). You probably are not running latest db2sock code. Speculation includes, not ftp new files to IBM i, or, perhaps installed wrong directory for node to see, or .. and number of user errors.

    bash-4.3$ node toobigtozero.js 
    input:
    {"pgm":[
        {"name":"DANNY04", "lib":"DB2JSON"},
        {"s": {"name":"inCount", "type":"10i0", "value":0, "by":"in"}},
        {"ds": [{"name":"inputDS","dim":20, "by": "in"},
            {"s":[
                {"name":"in1", "type":"100a", "value":"i1"},
                {"name":"in2", "type":"100a", "value":"i2"}
            ]}
        ]},
        {"s": {"name":"outCount", "type":"10i0"}},
        {"ds": [{"name":"outputA","dim":15000, "by": "out", "dou": "outCount"},
            {"s":[
                {"name":"o1", "type":"500a", "value":"i1"},
                {"name":"o2", "type":"500a", "value":"i2"}
            ]}
        ]},
        {"s": {"name":"last", "type":"20a", "value":"ll"}}
    ]}
    so big = 643
    
    output:
    {"script":[{"pgm":["DANNY04","DB2JSON",
    {"outCount":0},
    {"outputA":[]},
    {"last":"\"quoted\" text"}]}]}
    so big = 99
    
  6. Brian Jerome reporter

    Got it running correctly now. Tried it on a few other PGMs and having an issue with a missing open bracket:

    {"script":[{"pgm":["PGMNAME","PGMLIB",{"DSCOUNT":0},{"DS":]}]}]}
    

    It might have something to do with the DS being both input and output, but will have to try creating a test PGM to reproduce.

  7. Former user Account Deleted

    ... with a missing open bracket

    I may have found this ... wait a moment for new version.

  8. Former user Account Deleted

    Ok, I have a new version that should fix your missing open bracket.

    • Yips Super Driver - test driver - 1.1.4-sg13 - toolkit - more dou zero count miss begin array empty (Brian)

    You probably are not running latest db2sock code.

    I also added a version json feature.

    bash-4.3$ ./test4000_sql400json_procj32 ../json/j9101_admin_version
    input(5000000):
    {"admin":[{"info":"version"}]}
    
    
    output(49):
    {"script":[{"admin":[{"version":"1.1.4-sg13"}]}]}
    
    result:
    success (0)
    
  9. Log in to comment