|
I have used similar tricks for debugging service programs but typically just put a sleep in the Java caller or a break point in the debugger. In the past when I have not had control of the C program I am calling I have had to manually add the terminating null chars to my C string parms from the Java code. This is because the called program treats the parms as char* instead of specific lengths. Here is an example of setting up a string parm to null terminate it. I am sure there are easier ways. AS400Text lib = new AS400Text(productLibrary.length(), as400System); bytesParm = lib.toBytes(productLibrary); bytes = new byte[productLibrary.length() + 1]; System.arraycopy(bytesParm, 0, bytes, 0, bytesParm.length); parameterList[1] = new ProgramParameter(bytes); "Chris Wolcott" <CWolcott@trailbl azersystems.com> To Sent by: <java400-l@xxxxxxxxxxxx> java400-l-bounces cc @midrange.com Subject RE: Calling *SRVPGMs from JAVA - 12/16/2004 03:13 How to DEBUG? PM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@midran ge.com> This app requires V5R2M0 or higher. We figured out how to debug it. In the JAVA code, we create the 400 object, then display the job info and do a read from the keyboard. Using the job info we issue a STRSRVJOB and STRDBG, adding the *SRVPGM. After setting break points, we enter any key in the JAVA app and the *SRVPGM procedures break were we set them to. We have not looked anymore at why we can't seem to pass char variables, but now that we've figured out debuging we can give it another try. I take it I couldn't always find the job because the loglvl was probably defaulting to *NOLIST. I added a system() call to do a CHGJOB and set the log level to *SECLVL. I still don't know why I couldn't find the printf() output, but we haven't tried that approch for a while. > message: 3 > date: Thu, 16 Dec 2004 07:49:43 -0800 > from: "Gary L Peskin" <garyp@xxxxxxxxxxxx> > subject: RE: Calling *SRVPGMs from JAVA - How to DEBUG? > > What release of OS/400 are you on? > > > -----Original Message----- > > Subject: Calling *SRVPGMs from JAVA - How to DEBUG? > > > > Our biggest issue is debugging the *SRVPGM procedures. How > do we do > > that? I can't figure out where the *SRVPGM is running. The JAVA > > program prints the job info it gets, but I can't always > find that job > > and even if I do there is nothing useful there. If I have the C use > > printf() I can't find the output. Anyone know where the > output goes > > and how to debug this? > > > > We have a JAVA program that needs to call a *SRVPGM that contains > > *MODULEs written in C, CL and RPG. Calling the C is not too bad, > > except we seem to have issues passing char variables. We've got > > around it so far by just passing them as char * instead, > but we have > > to write wrappers for the procedures that expect plain char > > parameters. > > > > We also seem to have found that whatever job the *SRVPGM is > running in > > on the iSeries does not seem to have a *LIBL. We had to write a > > procedure that calls an existing CL that sets the appropriate *LIBL. > > This is mainly an issue with the RPG, since the C can specify the > > library as a variable at run time. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.