• Subject: Re: What record return from getNewRecord() ??
  • From: francess@xxxxxxxxxx
  • Date: Thu, 9 Mar 2000 13:36:48 -0600

The RecordFormat.getNewRecord() returns an empty record for the particular
record format.  The typical use for this method is to set the contents of
the fields for the record and then use it to write a record to a file
(AS400File.write()).

The RecordFormat class does not return a record from a file, use one of the
AS400File.read() methods (read(), readFirst(), readNext(), etc.), for that.

For more information, checkout
http://publib.boulder.ibm.com/pubs/html/as400/ic2924/info/java/rzahh/toolbox.htm

In the left hand frame, expand Access Classes and then select Record-Level
Access.


Frances Stewart
Java II and Applications Enablement
External: (507) 253-2795
Tie-line: 8-553-2795
IBM Rochester


Martinus Ivan <IVANM@MULTIPOLAR.CO.ID> on 03/08/2000 11:36:16 PM

Please respond to JAVA400-L@midrange.com

To:   "'JAVA400-L@midrange.com'" <JAVA400-L@midrange.com>
cc:
Subject:  What record return from getNewRecord() ??





> Hi All,
>
> I have a confusion about getNewRecord() method from RecordFormat Class
> (I'm using ToolBox version from JBuilder/400).
> I create a small PF file call MyData and its only have one field (20
*char
> long).
> I add two record in it. And develop a small java program just to learn
the
> characteristic of getNewRecord().
>
> Base on my code below I don't understand :
>    Why the.......System.out.println(dat.toString()).......print nothing
>
> And the disconnectAllServices() didn't work. The program seems do not
> return/finished.
> I'm very sure it not because of object authority problem in AS/400.
> Hope some who have try this method can share it....:)
> Thanks in Advance
>
> regards,
> Ivan. L
>
>
/*************************************************************************
> **********
> import com.ibm.as400.access.*;
>
> class filedesc {
>        public static void main (String args[]) {
>    AS400 TheAS400 = new AS400("XXX.XXX.XXX.XXX");
>
>            try {
>               SequentialFile dataf = new
> SequentialFile(TheAS400,"/QSYS.LIB/MyLib.LIB/MyData.FILE");
>
>      AS400FileRecordDescription file_desc = new
> AS400FileRecordDescription
>
> (TheAS400,"/QSYS.LIB/MyLib.LIB/MyData.FILE");
>
>          //Retrieve the MyData file record format description
>               RecordFormat datarec = file_desc.retrieveRecordFormat()[0];
>
>         // Set the record format for dataf file object before open it
>      dataf.setRecordFormat(datarec);
>
>        // Open the file
>
> dataf.open(AS400File.READ_ONLY,0,AS400File.COMMIT_LOCK_LEVEL_NONE);
>               Record dat = datarec.getNewRecord();
>              System.out.println(dat.toString());
>          }
>      catch(Exception e) {
>         e.printStackTrace();
>          }
>
>    mpcas410.disconnectAllServices();
>
>    }
> }
> /*****************************************************************
>
>
+---
| 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 thread ...


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

This mailing list archive is Copyright 1997-2022 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.