× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: FW: record-level access
  • From: "Cummings, Wanda" <Cummings@xxxxxx>
  • Date: Wed, 17 May 2000 09:29:37 -0400



> -----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
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.