Again, thanks Dieter...seems like a lot of work just to pass a single string to an API!  I thought about wrapping an RPG program, creating a C command program I could call with a system call from Java and a bunch of other approaches.  I appreciate the pointers. I'm getting closer.....

Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java
AWS Certified Cloud Practitioner
Microsoft Certified: Azure Fundamentals
Twitter - Sys_i_Geek IBM_i_Geek

On 10/8/2021 1:19 AM, D*B 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




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.