You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/09/01 05:19:00 UTC

[jira] [Assigned] (CAMEL-16907) camel-jt400 - Program Call usability concerns

     [ https://issues.apache.org/jira/browse/CAMEL-16907?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-16907:
-----------------------------------

    Assignee: Jesse Gorzinski

> camel-jt400 - Program Call usability concerns
> ---------------------------------------------
>
>                 Key: CAMEL-16907
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16907
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jt400
>    Affects Versions: 3.11.0
>            Reporter: Jesse Gorzinski
>            Assignee: Jesse Gorzinski
>            Priority: Minor
>             Fix For: 3.12.0
>
>
> The program call abilities are not very usable.
> When running in binary mode, all parameters must be converted to byte arrays, like so:
> {code:java}
>         final int usrSpcSize = 16;//16776704;
>         final String pgmCallUri = String.format("jt400://*CURRENT:*CURRENt@localhost/qsys.lib/QUSRTVUS.PGM?fieldsLength=20,4,4,%d&outputFieldsIdx=3&format=binary", usrSpcSize);
>         context.addRoutes(new RouteBuilder() {
>             @Override
>             public void configure() {
>                 from("timer://foo?period=5000")
>                 .process( exchange -> {
>                     String usrSpc = "MYSPACE   JESSEG    ";
>                     Object[] parms = new Object[] {
>                         usrSpc.getBytes("Cp037"),  // Qualified user space name
>                         intToBytes(1),             // starting position
>                         intToBytes(usrSpcSize),    // length of data
>                         new byte[usrSpcSize]       // output
>                     };
>                     exchange.getIn().setBody(parms);
>                 })
>                 .to(pgmCallUri)
>                 .setBody(simple("${body[3]}"))
>                 .to("stream:out");
>             }
>         });
> {code}
> Note, any character output must be explicitly converted from an EBCDIC byte array to a String (but the ccsid is unknown, so the "Cp037" in the above example is just a guess)
> In non-binary mode, all input parameters must be text, and I can't figure out how to actually send common data types, most notably integers.
> I will work on and likely send a PR shortly



--
This message was sent by Atlassian Jira
(v8.3.4#803005)