RE: Passing an as400structure in a ServiceProgramCall
Augusto Sepulveda Bilbao <[email protected]> Sun, 3 Apr 2022 14:24:26 +0000
| Newsgroups | gmane.comp.lang.as400.java |
|---|---|
| Message-ID | <BN6PR18MB163618BF5839E123337263F3C3E29@BN6PR18MB1636.namprd18.prod.outlook.com> |
Hi. In my experience, I never use the binary field, as IBM recomend. Instead I use int() 3,5,10,20 [cid:[email protected]] Change prototipe and procedure to use (int 3, 5, 10, 20) Compile new PCML, créate svrpgm with new module and in java use the new pcml. Hope this help you. Augusto Sepulveda TCS Systems Analyst Tel +57 3218640174 De: Pete Helgren<mailto:[email protected]> Enviado: Saturday, April 2, 2022 4:49 PM Para: Java Programming on and around the IBM i<mailto:[email protected]> Asunto: Passing an as400structure in a ServiceProgramCall 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) -- 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