Tried and failed at this last fall but I am making another stab at it.  I am calling a DCM API from Java ("/QSYS.LIB/QICSS.LIB/QYCDRNWC.SRVPGM")  The format is RNW0300. The part that I am struggling with is that one of the parameters is a structure.  Like so (from docs):

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(*)

That first parameter is a structure (Format RNW0300). It looks like this:

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

I coded it in Java like so:

  AS400DataType[] format = {
  // 0 0 Binary (4) Offset to certificate path and file name
       new AS400Bin4(),
  // 4 4 Binary (4) Length of certificate path and file name
       new AS400Bin4(),
  // Char (*) Certificate path and file name
       new AS400Text(certificate_path.length())
  };

  AS400Structure rnw0300 = new AS400Structure(format);

Then I set the parameter like this:

 // Set up the parms
    ProgramParameter[] parameterList = new ProgramParameter[4];
 // 1 Certificate request data Input Char(*) the structure for format RNW0300
    parameterList[0] = new ProgramParameter(rnw0300.toBytes(new Object[] { 8, certificate_path.length(), certificate_path }));
 // 2 Length of certificate request data Input Binary(4)
    parameterList[1] = new ProgramParameter(new AS400Bin4().toBytes(rnw0300.getByteLength()));
 // 3 Format name Input Char(8)
    parameterList[2] = new ProgramParameter(new AS400Text(8).toBytes(apiFormat));
 // 4 Error Code I/O Char(*)
    ErrorCodeParameter ec = new ErrorCodeParameter(true, true);
    parameterList[3] = ec;

When calling the service program I get this error returned:

AS400Message (ID: CPF9872 text: Program or service program QYCDRNWC in library QICSS ended. Reason code 2.):com.ibm.as400.access.AS400Message@b7566fbf

The message description says this:

Message ID . . . . . . . . . :   CPF9872

Message file . . . . . . . . :   QCPFMSG

  Library  . . . . . . . . . :     QSYS


Message . . . . :   Program or service program &1 in library &2 ended. Reason

  code &3.

Cause . . . . . :   The specified program or service program was ended due to

  one of the following:

    1 -- A pointer was used that is not available for use while running in the

  current program state.

    2 -- A pointer was used, either directly or as a basing pointer, that has

  not been set to an address.


So it seems to indicate that a pointer isn't properly set.  Not sure which parameter it is complaining about but my guess is that it is the structure reference.

Bit of a noob at this but it seems pretty simple.  Do you see anything that is radically wrong?  I couldn't find a good example of passing a AS400Structure as an input parameter....(perhaps my assumption that that is the issue is wrong)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2022 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.