Don't convert 'out' data from EBCDIC to UTF8

Issue #11 resolved
Sebastian Misiewicz created an issue

I'm wondering if it's possible to force Toolkit/JSON parser to return data without conversion from EBCDIC to UTF8 (my RPG program returns data already encoded as UTF8). Currently the toolkit unconditionally converts data from EBCDIC to UTF8 (I believe it's ile_pgm_char_2_output in PaseToIle.c)

The XMLSERVICE has nice feature where you can ask to convert data 'after'

var pgm = new xt.iPgm("MYPGM", { lib: "MYLIB", func: "MYFUNC", error: "on" } ); 
pgm.addParam('', '1000000A', {after:1208} );

so is it possible add something like 'dontConvertOutData' to 'pgm' invocation

{"pgm":[{"name":"HELLO",  "lib":"DB2JSON"},
        {"s":{"name":"char", "type":"128a", "value":"Hi there","dontConvertOutData":true}}
       ]}

I know I could use Binary data then convert data by myself.

Regards Sebastian

Comments (4)

  1. Former user Account Deleted

    RPG program returns data already encoded as UTF8 ... so is it possible add something like 'dontConvertOutData' to 'pgm' invocation

    Yes. We could add something like this on data. Also, congrats on being progressive RPG with UTF8. However, you will be in RPG UTF8 minority (1%), against RPG EBCDIC majority (99%). That meaning, we shall "go with the flow" leaving default as convert EBCDIC<2>ASCII.

    I will look at soon (after few meetings today). Thanks for helping.

  2. Former user Account Deleted

    ... force Toolkit/JSON parser to return data without conversion from EBCDIC to UTF8 (my RPG program returns data already encoded as UTF8)

    Ok. I added support.

    • Yips Super Driver - test driver - 1.1.1-sg7 - toolkit json data “noconv”:”in|out|both” (Sebastian Misiewicz)

    Note: You will only use "noconv":"both", no convert input, no convert output, because your data is already UTF-8 both ILE/PASE (below). However, I am adding "noconv":"in" and "noconv":"out" for future unknown use cases (crazy stuff somebody may find useful).

    bash-4.3$ ./test1000_sql400json32 ../json/j08408_srvpgm_value_rainchar8_noconv
    input(5000000):
    {"pgm":[{"name":"RAINSRV", "lib":"DB2JSON", "func":"RAINCHAR8"},
            {"s":[{"name":"a1", "type":"8a",  "value":"11111111", "by":"val", "noconv":"both"},
                  {"name":"a2", "type":"8a",  "value":"22222222", "by":"val", "noconv":"both"},
                  {"name":"a3", "type":"8a",  "value":"33333333", "by":"val", "noconv":"both"},
                  {"name":"a4", "type":"8a",  "value":"44444444", "by":"val", "noconv":"both"},
                  {"name":"o1", "type":"8a",  "value":"55555555", "noconv":"both"},
                  {"name":"o2", "type":"8a",  "value":"66666666", "noconv":"both"},
                  {"name":"o3", "type":"8a",  "value":"77777777", "noconv":"both"},
                  {"name":"o4", "type":"8a",  "value":"88888888", "noconv":"both"}
                 ]}
           ]}
    
    
    output(198):
    {"script":[{"pgm":["RAINSRV","DB2JSON","RAINCHAR8",{"a1":"11111111"},{"a2":"22222222"},{"a3":"33333333"},{"a4":"44444444"},{"o1":"11111111"},{"o2":"22222222"},{"o3":"33333333"},{"o4":"44444444"}]}]}
    
    result:
    success (0)
    

    Please test more in your specific environment. Thanks for the idea.

  3. Log in to comment