com.SoftWoehr.JTOpenContrib.MEU
Class MEUFileMember

java.lang.Object
  |
  +--com.SoftWoehr.JTOpenContrib.MEU.MEUFileMember

public class MEUFileMember
extends java.lang.Object

Represents the AS400 file member which is being edited.


Field Summary
static java.math.BigDecimal ONE_POINT_OH_OH
          Used in resequencing
static int SRCDAT_INDEX
          Record field
static int SRCDTA_INDEX
          Record field
static int SRCSEQ_INDEX
          Record field
 
Constructor Summary
MEUFileMember(com.ibm.as400.access.AS400 as400, java.lang.String lib, java.lang.String file, java.lang.String member)
          Creates new MEUFileMember
 
Method Summary
 void appendRecord(com.ibm.as400.access.Record r)
          Append a record to the working vector of records
 void close()
          Close the file.
 void createMember(com.ibm.as400.access.RecordFormat rf, java.lang.String textDescription)
          Run this on an un-open'ed MEUFileMember that doesn't yet exist on the server to create this member.
 void createMember(java.lang.String textDescription)
          Run this on an un-open'ed MEUFileMember that doesn't yet exist on the server to create this member.
 void displayRecordFormat()
          Display record format of a SRCPFM.
 java.util.Enumeration elements()
          Return all records in an enumeration
 java.lang.String getIFSPath()
          Return the IFS path for the file member represented by this instance.
 java.lang.String getLibraryName()
          Return the name of the which this MEUFileMember represents
 java.lang.String getMemberName()
          Return the name of the member which this MEUFileMember represents
 com.ibm.as400.access.Record getNewRecord()
          Return a new record in this file's format.
 com.ibm.as400.access.Record getNewRecord(java.math.BigDecimal srcseq, java.math.BigDecimal srcdat, java.lang.String srcdta)
          Get a new record with its fields filled in
 int getNumberOfRecords()
          How many records are there?
 java.lang.String getObjectName()
          Return the name of the object (file) which this MEUFileMember represents
 com.ibm.as400.access.QSYSObjectPathName getObjectPath()
          Return the object path object which holds the name of the file member
 com.ibm.as400.access.Record getRecordAt(int index)
          Get a specific record (from 0 to numrecs - 1).
 com.ibm.as400.access.RecordFormat getRecordFormat()
           
 com.ibm.as400.access.RecordFormat getRecordFormatTheHardWay()
          Get the record format for this source member.
static java.math.BigDecimal getSRCDAT(com.ibm.as400.access.Record r)
          Get the date field
static java.lang.String getSRCDTA(com.ibm.as400.access.Record r)
          Get the text field
 java.lang.String getSRCDTAcontents(int recnum)
          Get the text field by row number
 int getSRCDTAlength()
          Return the length of the source text field
static java.math.BigDecimal getSRCSEQ(com.ibm.as400.access.Record r)
          Get the sequence field
 com.ibm.as400.access.AS400 getSystem()
          Return server file resides on.
 void insertRecord(com.ibm.as400.access.Record r, int index)
          Insert a record into the working vector of records
 boolean isOpen()
          Check if the file has been opened
static void main(java.lang.String[] argv)
          Just a quick test of record access
 void open()
          Open the file on the host sytsem
static boolean pathExists(com.ibm.as400.access.AS400 sys, com.ibm.as400.access.QSYSObjectPathName qPath)
          Return true if the system object referred to by the ifsPath exists
 void readAll()
          Read in all records
 java.lang.String recordsToString()
          Diagnostic dump of all records to a string
 void removeAllRecords()
          Remove all records from our working vector of records
 void removeRecord(int index)
          Remove a record from our working vector of records
 void resequence()
          Reset the sequence numbers of all records
 void resequenceFrom(int index, int postindex, java.math.BigDecimal seqnum, java.math.BigDecimal increment)
          Resequence a range of records.
 boolean setRecordFormat()
          Cause fetch of record format
 boolean setRecordFormat(com.ibm.as400.access.RecordFormat rf)
          Set record format if not open, also clearing records.
 void setSRCDAT(com.ibm.as400.access.Record r, java.math.BigDecimal datum)
          Set the date field
 void setSRCDTA(com.ibm.as400.access.Record r, java.lang.String datum)
          Set the text field
 void setSRCSEQ(com.ibm.as400.access.Record r, java.math.BigDecimal datum)
          Set the sequence field
static void testRead(java.lang.String server, java.lang.String lib, java.lang.String file, java.lang.String member)
          Read in records and display
static void testWrite(java.lang.String server, java.lang.String lib, java.lang.String file, java.lang.String member)
          Read in records, modify, and write out
 void writeAll()
          Write out all records.
 void writeAllClearingMember()
          Clear the member and refill fresh will all records.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SRCSEQ_INDEX

public static final int SRCSEQ_INDEX
Record field

SRCDAT_INDEX

public static final int SRCDAT_INDEX
Record field

SRCDTA_INDEX

public static final int SRCDTA_INDEX
Record field

ONE_POINT_OH_OH

public static final java.math.BigDecimal ONE_POINT_OH_OH
Used in resequencing
Constructor Detail

MEUFileMember

public MEUFileMember(com.ibm.as400.access.AS400 as400,
                     java.lang.String lib,
                     java.lang.String file,
                     java.lang.String member)
Creates new MEUFileMember
Method Detail

getSystem

public com.ibm.as400.access.AS400 getSystem()
Return server file resides on.

getObjectPath

public com.ibm.as400.access.QSYSObjectPathName getObjectPath()
Return the object path object which holds the name of the file member

getIFSPath

public java.lang.String getIFSPath()
Return the IFS path for the file member represented by this instance.

getLibraryName

public java.lang.String getLibraryName()
Return the name of the which this MEUFileMember represents

getObjectName

public java.lang.String getObjectName()
Return the name of the object (file) which this MEUFileMember represents

getMemberName

public java.lang.String getMemberName()
Return the name of the member which this MEUFileMember represents

getRecordFormatTheHardWay

public com.ibm.as400.access.RecordFormat getRecordFormatTheHardWay()
                                                            throws com.ibm.as400.access.AS400Exception,
                                                                   com.ibm.as400.access.AS400SecurityException,
                                                                   java.lang.InterruptedException,
                                                                   java.io.IOException
Get the record format for this source member.

getRecordFormat

public com.ibm.as400.access.RecordFormat getRecordFormat()
                                                  throws com.ibm.as400.access.AS400Exception,
                                                         com.ibm.as400.access.AS400SecurityException,
                                                         java.lang.InterruptedException,
                                                         java.io.IOException,
                                                         java.beans.PropertyVetoException
Returns:
 
Throws:
AS400Exception -  
AS400SecurityException -  
java.lang.InterruptedException -  
IOException -  
PropertyVetoException -  

setRecordFormat

public boolean setRecordFormat()
Cause fetch of record format

setRecordFormat

public boolean setRecordFormat(com.ibm.as400.access.RecordFormat rf)
                        throws java.beans.PropertyVetoException
Set record format if not open, also clearing records. Return false if open.

getSRCDTAlength

public int getSRCDTAlength()
Return the length of the source text field
Returns:
the length of the field or zero (0) if can't get record format

getSRCDTAcontents

public java.lang.String getSRCDTAcontents(int recnum)
Get the text field by row number

getNewRecord

public com.ibm.as400.access.Record getNewRecord()
                                         throws com.ibm.as400.access.AS400Exception,
                                                com.ibm.as400.access.AS400SecurityException,
                                                java.lang.InterruptedException,
                                                java.io.IOException,
                                                java.beans.PropertyVetoException
Return a new record in this file's format.

getNewRecord

public com.ibm.as400.access.Record getNewRecord(java.math.BigDecimal srcseq,
                                                java.math.BigDecimal srcdat,
                                                java.lang.String srcdta)
                                         throws com.ibm.as400.access.AS400Exception,
                                                com.ibm.as400.access.AS400SecurityException,
                                                java.lang.InterruptedException,
                                                java.io.IOException,
                                                java.beans.PropertyVetoException
Get a new record with its fields filled in

setSRCSEQ

public void setSRCSEQ(com.ibm.as400.access.Record r,
                      java.math.BigDecimal datum)
Set the sequence field

setSRCDAT

public void setSRCDAT(com.ibm.as400.access.Record r,
                      java.math.BigDecimal datum)
Set the date field

setSRCDTA

public void setSRCDTA(com.ibm.as400.access.Record r,
                      java.lang.String datum)
Set the text field

getSRCSEQ

public static java.math.BigDecimal getSRCSEQ(com.ibm.as400.access.Record r)
                                      throws java.io.UnsupportedEncodingException
Get the sequence field

getSRCDAT

public static java.math.BigDecimal getSRCDAT(com.ibm.as400.access.Record r)
                                      throws java.io.UnsupportedEncodingException
Get the date field

getSRCDTA

public static java.lang.String getSRCDTA(com.ibm.as400.access.Record r)
                                  throws java.io.UnsupportedEncodingException
Get the text field

insertRecord

public void insertRecord(com.ibm.as400.access.Record r,
                         int index)
                  throws java.lang.ArrayIndexOutOfBoundsException
Insert a record into the working vector of records

appendRecord

public void appendRecord(com.ibm.as400.access.Record r)
Append a record to the working vector of records

removeRecord

public void removeRecord(int index)
                  throws java.lang.ArrayIndexOutOfBoundsException
Remove a record from our working vector of records

removeAllRecords

public void removeAllRecords()
Remove all records from our working vector of records

getNumberOfRecords

public int getNumberOfRecords()
How many records are there?

elements

public java.util.Enumeration elements()
Return all records in an enumeration

getRecordAt

public com.ibm.as400.access.Record getRecordAt(int index)
Get a specific record (from 0 to numrecs - 1).

resequence

public void resequence()
Reset the sequence numbers of all records

resequenceFrom

public void resequenceFrom(int index,
                           int postindex,
                           java.math.BigDecimal seqnum,
                           java.math.BigDecimal increment)
Resequence a range of records. It's the callers responsibility to determine that one doesn't overrun a later range of sequence numbers.

pathExists

public static boolean pathExists(com.ibm.as400.access.AS400 sys,
                                 com.ibm.as400.access.QSYSObjectPathName qPath)
                          throws java.io.IOException
Return true if the system object referred to by the ifsPath exists

createMember

public void createMember(com.ibm.as400.access.RecordFormat rf,
                         java.lang.String textDescription)
                  throws com.ibm.as400.access.AS400Exception,
                         com.ibm.as400.access.AS400SecurityException,
                         java.lang.InterruptedException,
                         java.io.IOException,
                         java.beans.PropertyVetoException
Run this on an un-open'ed MEUFileMember that doesn't yet exist on the server to create this member. The member that is created is the one named by the MEUFileMember object. This routine meant to be used to start edit session.

createMember

public void createMember(java.lang.String textDescription)
                  throws com.ibm.as400.access.AS400Exception,
                         com.ibm.as400.access.AS400SecurityException,
                         java.lang.InterruptedException,
                         java.io.IOException,
                         java.beans.PropertyVetoException
Run this on an un-open'ed MEUFileMember that doesn't yet exist on the server to create this member. The member that is created is the one named by the MEUFileMember object. This routine meant to be used to start edit session.

isOpen

public boolean isOpen()
Check if the file has been opened

open

public void open()
          throws com.ibm.as400.access.AS400Exception,
                 com.ibm.as400.access.AS400SecurityException,
                 java.lang.InterruptedException,
                 java.io.IOException,
                 java.beans.PropertyVetoException
Open the file on the host sytsem

readAll

public void readAll()
             throws com.ibm.as400.access.AS400Exception,
                    com.ibm.as400.access.AS400SecurityException,
                    java.lang.InterruptedException,
                    java.io.IOException,
                    java.beans.PropertyVetoException
Read in all records

writeAll

public void writeAll()
              throws com.ibm.as400.access.AS400Exception,
                     com.ibm.as400.access.AS400SecurityException,
                     java.lang.InterruptedException,
                     java.io.IOException
Write out all records. Caller should make sure file is open.

writeAllClearingMember

public void writeAllClearingMember()
                            throws com.ibm.as400.access.AS400Exception,
                                   com.ibm.as400.access.AS400SecurityException,
                                   java.lang.InterruptedException,
                                   java.io.IOException,
                                   com.ibm.as400.access.ErrorCompletingRequestException,
                                   com.ibm.as400.access.ExtendedIllegalStateException,
                                   java.beans.PropertyVetoException
Clear the member and refill fresh will all records.

close

public void close()
           throws com.ibm.as400.access.AS400Exception,
                  com.ibm.as400.access.AS400SecurityException,
                  java.lang.InterruptedException,
                  java.io.IOException
Close the file.

displayRecordFormat

public void displayRecordFormat()
Display record format of a SRCPFM.

testRead

public static void testRead(java.lang.String server,
                            java.lang.String lib,
                            java.lang.String file,
                            java.lang.String member)
Read in records and display

testWrite

public static void testWrite(java.lang.String server,
                             java.lang.String lib,
                             java.lang.String file,
                             java.lang.String member)
Read in records, modify, and write out

recordsToString

public java.lang.String recordsToString()
Diagnostic dump of all records to a string

main

public static void main(java.lang.String[] argv)
Just a quick test of record access