RE: PCML Structure length

Augusto Sepulveda Bilbao <[email protected]> Fri, 5 Aug 2022 19:36:17 +0000
Newsgroups gmane.comp.lang.as400.java
Message-ID <BN6PR18MB163616E9C1B35F7D91A29E97C39E9@BN6PR18MB1636.namprd18.prod.outlook.com>
What I see is the lenght for binary ("type="int" length="4"?) it should be ("type="int" length="10"?)
Binary to int
2 = 5
4 = 10
8 = 20

Maybe this can help

Regards,
Augusto Sepulveda
Email: [email protected]

De: Pete Helgren<mailto:[email protected]>
Enviado: Friday, August 5, 2022 11:20 AM
Para: Java Programming on and around the IBM i<mailto:[email protected]>
Asunto: PCML Structure length

Working with a PCML call that I *almost* have working....the issue seems
to be that one of the parameters is the length of the structure which I
am not sure how to calculate/get.  The API being called is:

https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/apis/qycdrnwc.htm
(yeah, been working on this for a while).  The PCML file I created is:

<pcml version="2.0">

<!-- PCML source for calling "Renew Certificate" (QYCDRNWC) API -->

   <!-- Format RNWC0300 - Other formats are available -->
   <struct name="rnwc0300">
     <data name="offsettofile"               type="int"    length="4"  usage="input"/>
     <data name="lengthoffilename"           type="int"    length="4"  usage="input"/>
     <data name="certfile"                   type="char"   length="lengthoffilename" usage="input"/>
   </struct>

   <!-- Program QYCDRNWC and its parameter list for retrieving RNWC03000 format -->
   <program name="qycdrnwc" path="/QSYS.LIB/QICSS.LIB/QYCDRNWC.SRVPGM" entrypoint="QycdRenewCertificate">
     <data name="certreqdata"      type="struct"   struct="rnwc0300"   usage="input"/>
     <data name="reqdataLength"    type="int"      length="4"          usage="input" />
     <data name="format"           type="char"     length="8"          usage="input"    init="RNWC0300"/>
     <data name="errorCode"        type="int"      length="4"          usage="input"    init="0"/>
   </program>

</pcml>

The relevant code (Java) is this:

             pcml.setValue("qycdrnwc.certreqdata.offsettofile",8);
             pcml.setValue("qycdrnwc.certreqdata.lengthoffilename",pathlen);
             pcml.setValue("qycdrnwc.certreqdata.certfile",certificate_path);

             pcml.setValue("qycdrnwc.reqdataLength",[how to I get this value??]);

So the structure is constructed using the setValue methods for each
element of the structure.  But, I also need the length of the
qycdrnwc.certreqdata structure to pass as the second parameter.  I was
hoping that there was a PCML method called getLength(variable)...no joy.

How do I get the length of that structure?

--
Pete Helgren
www.petesworkshop.com<http://www.petesworkshop.com>
GIAC Secure Software Programmer-Java
AWS Certified Cloud Practitioner
Microsoft Certified: Azure Fundamentals
Twitter - Sys_i_Geek  IBM_i_Geek
--
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