nodejs-itoolkit icon indicating copy to clipboard operation
nodejs-itoolkit copied to clipboard

iPgm parameters: Make declarations for parameter types easier to use

Open alexandrahrastnik opened this issue 6 years ago • 7 comments

Hi!

This is rather a nice-to-have than an actual issue, but it seems to be worth to mention it. In our company, we currently modernize our ILE RPG software. Hence we go for free format. As far as I‘ve seen, we need to declare parameter types for iPgm with the classic format („10A“ instead of „char(10)“). May it be possible to support free format syntax in iPgm functions as well?

If I got it correctly, this may also be something that needs to be changed in the XMLSERVICE layer (?)

This is just syntactic sugar. But in long term, it may be better maintainable to have the same syntax in both definitions.

alexandrahrastnik avatar Aug 06 '19 19:08 alexandrahrastnik

I agree with this proposal completely. I am guessing if XMLSERVICE had the change, the the itoolkit modules for python, Node, PHP, Ruby could all benefit "for free" with no changes (but I haven't looked at the code).

I would suggest an issue on XMLSERVICE regardless, at http://github.com/IBM/XMLSERVICE

ThePrez avatar Aug 07 '19 02:08 ThePrez

As suggested, I opened an issue https://github.com/IBM/xmlservice/issues/43. Should I still leave this issue open, or would you prefer me to close it?

alexandrahrastnik avatar Aug 07 '19 05:08 alexandrahrastnik

I don't agree with this proposal. If anything, we should be reducing our coupling with RPG, not strengthening it. XMLSERVICE is a low-level service and its implementation should be shielded by the toolkits, though the Node toolkit went rather away from this for whatever reason.

I'd rather see wrapper classes for the different types and have them translate it in to what XMLSERVICE wants.

kadler avatar Aug 07 '19 15:08 kadler

Seems like a better options

alexandrahrastnik avatar Aug 07 '19 15:08 alexandrahrastnik

This should be rather easy to implement. My idea is to create a class (e.g. itypes) which exports constant functions. Example: const char = (chars) => return chars.toString() + “A“; So you could use it like: pgm.addParam(”dummy”, itypes.char(10)); What do you think about that?

This approach would still be compatible with existing implementations.

alexandrahrastnik avatar Aug 07 '19 21:08 alexandrahrastnik

Seems good to me. I'd probably forgo the class and just have a module that exports the functions.

Also FYI, going forward the intent is to drop the "i" prefix from things.

kadler avatar Aug 07 '19 22:08 kadler

:wave: Hi! This issue has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed.

github-actions[bot] avatar Feb 08 '20 00:02 github-actions[bot]