|
David, I just wanted to say that your notes and answers are probably the best I have seen for helping people work through their problems with the Toolbox. I am amazed at how you sort through the problems and provide helpful answers. I think that you are doing a heck of a job making the AS/400 much easier to use. Please feel free to pass this along to your boss... I think you deserve a nice compliment. And thanks. Nick Vrtis - Amway Corporation... dawall@us.ibm.com@midrange.com on 05/17/2000 10:57:22 AM Please respond to JAVA400-L@midrange.com Sent by: owner-java400-l@midrange.com To: JAVA400-L@midrange.com cc: Subject: 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 +---
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.