MIDRANGE dot COM Mailing List Archive



Home » JAVA400-L » May 2000

Re: Record Level Access Errors (Need Help)


  • Subject: Re: Record Level Access Errors (Need Help)
  • From: Nick_Vrtis@xxxxxxxxx
  • Date: Wed, 31 May 2000 13:47:21 -0400

fixed


Michael,

Java is very case sensitative... recordFormat and RecordFormat are
different.  Assuming that you cut and pasted the code, you have "new
recordFormat()".  It should probably be "new RecordFormat()".

Nick




"Gibbons, Michael" <bmis04@MARYWOOD1.MARYWOOD.EDU>@midrange.com on
05/31/2000 12:23:40 PM

Please respond to JAVA400-L@midrange.com

Sent by:  owner-java400-l@midrange.com


To:   "'Java-L'" <java400-L@midrange.com>
cc:

Subject:  Record Level Access Errors (Need Help)


Hi Folks,

Can anyone explain to me why i am getting these errors when compileing in
va
java.

The type named recordFormat is not defined.
The method getField invoked for type com.ibm.as400.access. RecordFormat
with
arguments [java.lang.String] is not defined.
The variable named SCDESCField is not defined.


I am trying to take a passed parameter "SEMESTER" (5 digit number) and
retrieve a record equal to "SEMESTER". I then want to pick up a description
field in that record ("SCDESCField")

public void getReqInfo(HttpServletRequest req, PrintWriter out) throws
ServletException, IOException {

      // Create an AS400 object.
      AS400 sys = new AS400("mis.marywood.edu");

      // Create a file object that represents the file
      KeyedFile SEMPCNTL = new KeyedFile(sys,
"/QSYS.LIB/DATALIBR.LIB/SEMPCNTL.FILE/%FILE%.MBR");

      // Assume that the AS400FileRecordDescription class was used to
generate the code for
      // a subclass of RecordFormat that represents the record format of
file SEMPCNTL in
      // library DATALIBR.
      RecordFormat recordFormat = new recordFormat();

      // Set the record format for SEMPCNTL. This must be done prior to
invoking open()
      SEMPCNTL.setRecordFormat(recordFormat);

      // Open the file.
      SEMPCNTL.open(AS400File.READ_WRITE, 0,
AS400File.COMMIT_LOCK_LEVEL_NONE);

      // The record format for the file contains one key field, SCREG
      Object[] key = new Object[1];
      key[0] = new Integer(req.getParameter("SEMESTER"));


      // Read the first record matching key
      Record keyedRecord = SEMPCNTL.read(key);

      // If the record was not found, null is returned.
      if (keyedRecord != null)
      { // Found the record, print out the info.

        // Retrieve the field value of Semester Description
        String SCDESCField=(String)recordFormat.getField("SCDESC");


        System.out.println("Semester Information for " + (String)key[0] +
":");
        System.out.println(keyedRecord);
      }

      // Close the file since I am done using it
      SEMPCNTL.close();

      // Disconnect since I am done using record-level access
      sys.disconnectService(AS400.RECORDACCESS);

          out.Println("You have selected the" + SCDESCField +
"semester");
          out.println("<H4><B>Additional Request
Information:</B></H4>");
          out.println("<B>Request method:</B> " + req.getMethod() +
"<BR>");
          out.println("<B>Request URI:</B> " + req.getRequestURI() +
"<BR>");
          out.println("<B>Servlet path:</B> " + req.getServletPath() +
"<BR>");
          out.println("<B>Servlet name:</B> " + req.getServerName() +
"<BR>");
          out.println("<B>Path info:</B> " + req.getPathInfo() +
"<BR>");


}

THANKS IN ADVANCE!

Michael P. Gibbons
Manager of Programming & Technical Services
MARYWOOD UNIVERSITY
2300 Adams Ave.
Scranton, PA 18509

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





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact