PGM Call JSON Output Issues
I’m not sure if I’m understanding the “by” functionality correctly or if this is incomplete, but when I add a “by”:”in” config to a parameter it is still included in the output. For example, I send something like {"s":{"name":"INPUT","type":"10a","value":"DATA","by":"in"}} and the output passes "pgm":["TEST","DANNY",{"INPUT":"DATA"}]. I would think if I specify "in" it should not be in the output.
Additionally, I have a simple RPG program that just returns a string. The config I’m sending for the parm is {"s":{"name":"RTRNCD","type":"8a","by":"out”}}. The RPG code is setting RTRNCD to an empty string, but the JSON output I’m getting for this parameter is {"RTRNCD":{}}. I would expect it to be {"RTRNCD":""}
Comments (6)
-
Account Deleted -
Account Deleted "RTRNCD":{} to "RTRNCD":""
Ok. I changed db2sock toolkit empty string.
- Yips Super Driver - test driver - 1.1.1-sg5 toolkit json change return empty string to “” (not {})
============================= test1000_sql400json32 ../json/j0180_pgm_hamela03-ds-rpg-occurs ============================= input(5000000): {"pgm":[ {"name":"HAMELA03", "lib":"DB2JSON"}, {"s": [ {"name":"Parm1", "type":"1a", "value":""}, {"name":"Parm2", "type":"18a", "value":"äöÄÖåÅáÁàÀ"}, {"name":"Parm3", "type":"2a", "value":""}, {"name":"Parm4", "type":"10a", "value":""}, {"name":"Arr1Count", "type":"3s0", "value":0} ]},
-
Account Deleted {"by":"in/out/both"}
Ok. I added "by":"in", to remove input params from the output json returned.
Yips Super Driver test driver - 1.1.1-sg6 toolkit add "by":"in" remove output
============================= test1000_sql400json64 ../json/j07411_srvpgm_value_rainint1_by_in ============================= input(5000000): {"pgm":[{"name":"RAINSRV", "lib":"DB2JSON", "func":"RAININT1"}, {"s":[{"name":"a1", "type":"3i0", "value":1, "by":"val"}, {"name":"a2", "type":"3i0", "value":2, "by":"val"}, {"name":"a3", "type":"3i0", "value":3, "by":"val"}, {"name":"a4", "type":"3i0", "value":4, "by":"val"}, {"name":"o1", "type":"3i0", "value":5, "by":"in"}, {"name":"o2", "type":"3i0", "value":6, "by":"in"}, {"name":"o3", "type":"3i0", "value":7, "by":"both"}, {"name":"o4", "type":"3i0", "value":8, "by":"in"} ]} ]} output(98): {"script":[{"pgm":["RAINSRV","DB2JSON","RAININT1", {"a1":1},{"a2":2},{"a3":3},{"a4":4}, {"o3":3}]}]} Note: o1, o2, o4 are missing, only o3 is output result: success (0)
Also works for ds structures (i think).
bash-4.3$ ./test1000_sql400json32 ../json/j0115_srvpgm_hello_ds_by_in input(5000000): {"pgm":[{"name":"HELLOSRV", "lib":"DB2JSON", "func":"HELLODS"}, {"ds":[{"s":{"name":"char", "type":"128a", "value":"Hi there"}},{"name":"parm","by":"in"}]}, {"ds":[{"s":{"name":"char", "type":"128a", "value":"Hi back"}},{"name":"retn","by":"return"}]} ]} output(105): {"script":[{"pgm":["HELLOSRV","DB2JSON","HELLODS", {"parm":[]}, {"retn":[{"char":"Hello World Again"}]}]}]} result: success (0)
Probably needs more testing ... that you could help out.
-
reporter Thanks Tony! Appreciate the quick turn-around. I will definitely run some thorough tests and will close the issue out when ready.
-
reporter Tested various PGM calls and have not been able to reproduce the 2 issues. Marking as resolved.
-
reporter - changed status to resolved
- Log in to comment
Correct. However, {"by":"in/out"} are not implemented yet in db2sock toolkit.
BTW -- Only {"by":"return"} is implemented (so far), allow srvpgm to return aggregate data (dcl-pi *N likeds(hello_ds_t);).
Return '{}' is a valid for json "empty" object. Mmm ... however ... perhaps json empty string is not considered a json empty object (below).
I will look into both issues.