|
The problem you have is that you are not setting on the LR indicator and because of this your RPG program stays active. If the program is active the file will be lock as you needed for output. This is a good technique if you are going to be calling the program many times, but in your case the program is open for output. Output program are open by RPG programs setting a lock because of obvious reasons. You can fix this problem by: 1. setting the *INLR to on before doing your return or 2. control the open and closing the file inside your program if you want to save the "opening time" of your program. I hope this helps.... vijayakumar purushothaman <p_vijayakumar@hotmail.com> on 06/05/2000 01:04:14 AM Please respond to JAVA400-L@midrange.com To: JAVA400-L@midrange.com cc: (bcc: Robert Arce/Whittman-Hart LP) Subject: RE: Calling a RPG pgm. Dear Martin, As you said am not opening the pf in java and also i couldn't see any kind of lock status for my PF in WRKOBJLCK. And in WRKACTJOB job status was JVAW. Here with i am attaching my pgms kindly go thru them and try to give me the solution. Thanks in Advance, Vijay. This is the BOOKPF - physical file. ************* Beginning of data ************ A R BOOKREC A EMPNO 5 0 **************** End of data *************** This is the BOOK2 - RPG program. ************** Beginning of data ************************************ FBOOKPF O E DISK C *ENTRY PLIST C PARM VAR1 50 C ADD 12 VAR1 C Z-ADDVAR1 EMPNO C WRITEBOOKREC C RETRN ***************** End of data *************************************** This is the Hbook2 - java program calls RPG program. ******************************************************************** import java.math.BigDecimal; import com.ibm.as400.access.*; public class Hbook2 { public static void main(String[] args) { Hbook2 Hbook2 = new Hbook2(); System.exit(0); } public Hbook2() { AS400 as400 = new AS400("localhost"); ProgramParameter[] pList = new ProgramParameter[1]; System.out.println("Constructing Parameters...."); // the parameter is input and output packed 5/0 BigDecimal decimalValue = new BigDecimal(5.0); pList[0] = new ProgramParameter(new AS400PackedDecimal(5,0).toBytes(decimalValue), 5); // Create the path to the program QSYSObjectPathName programName = new QSYSObjectPathName("/QSYS.LIB/VIJAY.LIB/BOOK2.PGM"); // Create the program call object ProgramCall inv0011 = new ProgramCall(as400, programName.getPath(), pList); System.out.println("Call made for Program Book2...."); // Execute the program try { if (inv0011.run() == false) { // Handle any errors of the program call failed AS400Message[] msgList = inv0011.getMessageList(); for (int i=0; i<msgList.length; i++) { System.out.println(msgList[i].getText()); } return; } } catch (ObjectDoesNotExistException dnf) { System.out.println("Program not found"); return; } catch (Exception error) { System.out.println("Exception: " + error); return; } // convert parameter back to Java BigDecimal packedReturn = (BigDecimal)new AS400PackedDecimal(5,0).toObject( pList[0].getOutputData()); // list out the returned values System.out.println("pList[0]: " + packedReturn.toString()); } } >From: Steve Martin <smartin@carefreeofcolorado.com> >Reply-To: JAVA400-L@midrange.com >To: JAVA400-L@midrange.com >Subject: RE: Calling a RPG pgm. >Date: Fri, 2 Jun 2000 06:06:07 -0600 > >Do you have the PF open in your Java Pgm? There may be a *LOCK state that >the RPG Pgm is waiting for... what does your job look like when you look at >WRKACTJOB? > > > -----Original Message----- > > From: vijayakumar purushothaman [SMTP:p_vijayakumar@hotmail.com] > > Sent: Thursday, June 01, 2000 10:56 PM > > To: JAVA400-L@midrange.com > > Subject: Calling a RPG pgm. > > > > Hi Folks, > > I am calling a rpg pgm thru java and also my rpg deals with >a > > physical file. When i run the java pgm it starts to hang indefinitely. >If > > i > > remove the pf then it works fine. I don't know the reason, any one can > > help. > > > > Thanks in Advance, > > Vijay. > > ________________________________________________________________________ > > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com > > > > +--- > > | This is the JAVA/400 Mailing List! > > | To submit a new message, send your mail to JAVA400-L@midrange.com. > > | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. > > | To unsubscribe from this list send email to > > JAVA400-L-UNSUB@midrange.com. > > | Questions should be directed to the list owner: joe@zappie.net > > +--- >+--- >| This is the JAVA/400 Mailing List! >| To submit a new message, send your mail to JAVA400-L@midrange.com. >| To subscribe to this list send email to JAVA400-L-SUB@midrange.com. >| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. >| Questions should be directed to the list owner: joe@zappie.net >+--- ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +--- +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
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.