Re: Passing an as400structure in a ServiceProgramCall

Pete Helgren <[email protected]> Sun, 3 Apr 2022 16:40:05 -0500
Newsgroups gmane.comp.lang.as400.java
Message-ID <[email protected]>
Thanks David,

EASIER is in the eye of the beholder.  PCML doesn't exactly look easy 
and I am up against the same unknowns.  Here is the PCML so far:

<pcml version="1.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 RNWC0300 
format -->
   <program name="qycdrnwc" path="/QSYS.LIB/QICSS.LIB/QYCDRNWC.SRVPGM">
     <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 structure for the RNWC0300 format is:

Offset
Dec  Hex    Type               Field
0        0       Binary (4)      Offset to certificate path and file name
4        4       Binary (4)       Length of certificate path and file name
Char (*)     Certificate path and file name

So my first "stump the chump" query was "What PCML data type is a 
Char(*)??" You can see my guess above. Is that correct? Just a character 
string of a certain length?  But, I think it is a pointer to the 
character string but couldn't find a good example of a Char(*) as an 
input parameter in a format structure.

The second conundrum was: How do I get the length of the structure? The 
parameters needed by the API are:

Required Parameter Group:

1    Certificate request data    Input    Char(*)

2    Length of certificate request data    Input    Binary(4)

3    Format name    Input    Char(8)

4    Error Code    I/O    Char(*)


Not sure if the whole thing is OK but I couldn't figure out how to get 
the length of the certificate request data (structure). I saw 
documentation in the PCML docs on "offset" and "offsetfrom" but didn't 
know if that is how to go about it.

This hasn't exactly been *easy* but I am willing to press on with a 
little hand-holding.....

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 4/2/2022 5:16 PM, David Gibbs via JAVA400-L wrote:
> Use pcml. It handles memory allocation and is much easier to use.
-- 
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: [email protected]
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