|
Thanx for your answers, it was very helpful!! -----Message d'origine----- De : dawall@us.ibm.com [mailto:dawall@us.ibm.com] Envoye : mercredi 17 mai 2000 13:16 A : JAVA400-L@midrange.com Objet : RE: FW: record-level access Like all JVMs, one way the AS/400 runs a Java program is interpretively. As the program is runs it reads the byte codes from the .class files, converts them to AS/400 instructions, then runs the instruction. On the AS/400 this is painfully slow (unusable in most cases). The AS/400 has two ways to improve performance. JIT (just in time) compile. With a JIT one thread is converting the byte codes to native instructions ahead of the thread that is running the instructions. The JIT also optimizes as it converts. The goal is to always have converted instructions ready to go and to optimize such that performance is better. All JVMs use JITs to improve performance. On the AS/40, JITs are getting better all the time but are not as good as choice 2 that follows. Associated Java Program. The AS/400 has an additional option. AS/400 command CRTJVAPGM will convert the byte codes to AS/400 instructions then save the instructions (in interpreted or JIT, the instructions are thrown away so they must be re-converted every time). The user can also specify a level of optimization to perform as the byte codes are converted. Now when the java program runs the byte codes are already converted so all the JVM has to do is run the instructions. The AS/400 instructions are saved in a hidden service program that is attached to the .class or .jar file. The AS/400 does all the necessary stuff to manage the hidden program (for example, it throws it away when the .class, .zip, or .jar file changes). Use command DSPJVAPGM to see the associated java program for a .jar, .zip or .class file. The AS/400 java program automatically first looks for the associated java program. If it doesn't find one it will do one of (1) run the program interpretively, (2) use the JIT or (3) run CRTJVAPGM under the covers depending on Java command parameters / properties. To make Java perform, all java code should have an associated java program. Your program and class libraries (such as the Toolbox) should have associated java programs. So, do a dspjvapgm on the Toolbox container (.zip or .jar) you use. If you don't see one create it (at optimization level 30). You won't believe the performance difference. David Wall 553-5329 AS/400 Toolbox for Java Pascal Bellerose <pascal.bellerose@progisys.com> on 05/17/2000 10:20:31 AM Please respond to JAVA400-L@midrange.com To: "'JAVA400-L@midrange.com'" <JAVA400-L@midrange.com> cc: Subject: RE: FW: record-level access To David Wall, You were talking about the fact that the toolbox container used in the program must be asociated to a Java program. What do you mean by an associated java program? what kind of program? and how could I associate this program to my jt400.jar? Thanx! Pascal Bellerose Progisys inc. Quebec, (Quebec, Canada) -----Message d'origine----- De : dawall@us.ibm.com [mailto:dawall@us.ibm.com] Envoye : mercredi 17 mai 2000 10:57 A : JAVA400-L@midrange.com Objet : Re: FW: record-level access >> CLASSPATH=/QIBM/ProdData/Java400/lib/jdkptf.zip: >> /QIBM/ProdData/Java400/lib/java.zip: >> /QIBM/ProdData/Java400/lib/sun.zip: >> /QIBM/ProdData/Java400/com/ibm/db2/jdbc/app/db2_classes.zip: >> /QIBM/ProdData/Java400/: >> /myjava Your classpath does not include the Toolbox access classes. Add "/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar" to your classpath and you should be set. There are a couple of ways to do this. In your example you use the -classpath parm of the Java command. You can change that to "java -classpath /myjava:/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar ShowMeClas" or setup up the CLASSPATH environment variable once in QSHELL by entering command "export -s CLASSPATH= /myjava:/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar" Since you talk about QSHELL you must be running on the AS/400. Make sure the Toolbox container you use (jt400.jar or jt400Access.zip) has an associated Java program. David Wall AS/400 Toolbox for Java "Cummings, Wanda" <Cummings@AE.com> on 05/17/2000 08:29:37 AM Please respond to JAVA400-L@midrange.com To: "'java400-l@midrange.com'" <java400-l@midrange.com> cc: Subject: FW: record-level access > -----Original Message----- > From: Cummings, Wanda > Sent: Tuesday, May 16, 2000 4:22 PM > To: 'java-l@midrange.com' > Subject: record-level access > > i have tried,for days, solving this myself, but i am convinced i need > help. > > i am trying to learn java on the as400. our manager wants us to read an > as400 PF and write a simple listing. > he wants us to try with record-level first (DDM), than move up to JDBC > > classpath shown in QSH > > > $ > > java -classpath /myjava ShowMeClas > > CLASSPATH=/QIBM/ProdData/Java400/lib/jdkptf.zip:/QIBM/ProdData/Java400/lib > /j > ava.zip:/QIBM/ProdData/Java400/lib/sun.zip:/QIBM/Prod > Data/Java400/com/ibm/db2/jdbc/app/db2_classes.zip:/QIBM/ProdData/Java400/: > /m > yjava > $ > > > my simple program: > > > import java.io.*; > import java.util.*; > import java.math.*; > import java.lang.*; > import com.ibm.as400.access.*; > > public class ListCust { > > public ListCust() { > // Step 1: > // Connect to an AS/400 > AS400 as400 = new AS400(); > > // Step 2: > // Specify file location > KeyedFile myFile = > new KeyedFile(as400, > "/qsys.lib/examples.lib/custmst.file"); > > > // Step 3: > // Retrieve a record format > AS400FileRecordDescription myFileDesc = > new AS400FileRecordDescription(as400, > "/qsys.lib/examples.lib/custmst.file"); > > try > { > > RecordFormat recFormats[] = myFileDesc.retrieveRecordFormat(); > myFile.setRecordFormat(recFormats[0]); > > // Step 4: > // open the file > myFile.open(AS400File.READ_ONLY, > 0, > AS400File.COMMIT_LOCK_LEVEL_NONE); > > // Step 5: > // Read a record > for (Record record = myFile.readNext(); > record != null; > record = myFile.readNext()) { > > // Step 6: > // Retrieve the field values of that record > BigDecimal CustnoField = > (BigDecimal) record.getField( "CUSNUM" ); > String NameField = > (String) record.getField( "LSTNAM" ); > System.out.println(NameField + CustnoField); > } > > // Close the file > myFile.close(); > > } catch (Exception e) { > System.out.println( > "Error occurred listing the file."); > > try > { > myFile.close(); > } catch(Exception x) { > System.out.println( > "Error occurred closing the file."); > } > System.exit(0); > } > System.exit(0); > } > > public static void main(String[] args) { > ListCust ListCust = new ListCust(); > > } > } > > errors from QSH execution: > > > > Loading class java/lang/ThreadDeath.class > > Loading class java/lang/NoSuchMethodError.class > > Loading class java/lang/IncompatibleClassChangeError.class > > Loading class java/lang/LinkageError.class > > Loading class java/lang/OutOfMemoryError.class > > Loading class ListCust.class > > Loading class com/ibm/as400/access/AS400File.class > > Failed to load class file: com/ibm/as400/access/AS400File.class > > Loading class java/lang/NoClassDefFoundError.class > > Loading class java/math/BigDecimal.class > > Loading class com/ibm/as400/access/AS400.class > > Failed to load class file: com/ibm/as400/access/AS400.class > > java.lang.NoClassDefFoundError: com/ibm/as400/access/AS400 > > ListCust.<init>()V+4 (ListCust.java:13) > > ListCust.main([Ljava/lang/String;)V+1 (ListCust.java:73) > > $ > > > > Thank you in advance for any help. I am having trouble understanding > classpath, do i need to change my autoexec.bat to reflect > QIBM/ProdData/HTTP/Public/jt400? > > +--- | 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 +--- +--- | 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 +--- +--- | 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.