Re: PCML Call reality check

Alan Campin <[email protected]> Fri, 8 Oct 2021 07:47:53 -0700
Newsgroups gmane.comp.lang.as400.java
Message-ID <CADVQcsg6PRQhNHxykMO8PBs=JwfqD5Xb-MpWsCcVYAvt1Mn5UA@mail.gmail.com>
Just curious, with the coming of Rest Services and how simple it makes
executing logic on the IBM i, is PCML obsolete? Why would you use PCML over
using a Rest Service?

On Thu, Oct 7, 2021 at 11:19 PM D*B <[email protected]> wrote:

> Pete,
>
> PCML is made for people, who want to write java code, looking like rpg.
> Thinking in rpg, you would have to do:
> - write an rpg wrapper for your api, with the same parms as the api (one
> to
> one)
> - compile it with CRTBNDRPG PGMINFO(*PCML) and throw it away and delete
> the
> rpg source
> - use the PCML to call the api, don't think about, how it works
>
> Thinking in java, you would need some Javabeans, one for each
> Datastructure,
> your api is using. This beans would be responsable to convert java
> datatypes
> to a compound of binary bits and bytes. This beans would have java like
> setXxx and getXxx methods, for each single component and the binary
> huddle,
> rpg named this binary huddle datastructure (a funny name, isn't it?).
> To call the Api, you would use ProgrammCall from jtopen.
>
> a little example for such a bean would look like:
>
> public class QualifiedName extends Converter {
>         private byte[] huddle;
>         private String name;
>         private String library;
>
>         public QualifiedName(String name, String library) {
>                 super(500);
>                 huddle = new byte[20];
>                 setName(name);
>                 setLibrary(library);
>         }
>
>         public byte[] getHuddle() {
>                 return huddle;
>         }
>
>         public void setName(String name) {
>                 this.name = name;
>                 System.arraycopy(stringToAS400Text(name, 10), 0, huddle,
> 0, 10);
>         }
>
>         public void setLibrary(String library) {
>                 this.library = library;
>                 System.arraycopy(stringToAS400Text(library, 10), 0,
> huddle, 10, 10);
>         }
> }
>
> getName, getLibrary and set Huddle would look very similar to the
> corresponding methods in the example.
> Datastructure is a Conveniance wrapper for the jtopen Objects to convert
> rpg
> types to java types and vice versa. The source could be found here:
>
>
> https://sourceforge.net/p/appserver4rpg/codeSVN/HEAD/tree/appserver4rpg/src/de/bender_dv/as400/datastructure/Converter.java
>
> Dieter
>
>
>
> --
> This is the Java Programming on and around the IBM i (JAVA400-L) mailing
> list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/java400-l
> or email: JAVA400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/java400-l.
>
> Help support midrange.com by shopping at amazon.com with our affiliate
> link: https://amazon.midrange.com
>
-- 
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/java400-l.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com