× 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.



Another customer asked for S/36 file support in the toolbox Record-Level
Database Access classes.  That support was added to JTOpen 2.05.  Give that
level of the Toolbox a try and see if it helps.

David Wall
AS/400 Toolbox for Java




                    AAnuszewski@hammer
                    .net                     To:     java400-l@midrange.com
                    Sent by:                 cc:
                    java400-l-admin@mi       Subject:     Record Level Access
                    drange.com


                    12/03/2001 10:07
                    AM
                    Please respond to
                    java400-l








I am stuck once again, and am in desperate need of help.  Quick overview:
I
need to access data stored on our AS400 in older System 36 type files.
Thus,
the physical file has a structure that basically only declares a delete
code, a
key, and then a long stream of data.

Thus, I have been forced to define my own record format within java.  I am
able
to read the file sequentially, but when I try to read it as a keyed file,
it
doesn't seem to find the key.

This is a snippet of the code:

// Set up the PO File
     CharacterFieldDescription deleteCode = new
CharacterFieldDescription(new
AS400Text(1), "POCODE"); //1
     CharacterFieldDescription PONumber = new CharacterFieldDescription(new
AS400Text(8), "PONO");  //2-9
     BinaryFieldDescription subRecord = new BinaryFieldDescription(new
AS400Bin2(), "POSUB"); //10-11
     CharacterFieldDescription accountNumber = new
CharacterFieldDescription(new
AS400Text(29), "POACCT"); //12-40
     CharacterFieldDescription vendorNumber = new
CharacterFieldDescription(new
AS400Text(7), "POVND#"); //41-47
     CharacterFieldDescription filler1 = new CharacterFieldDescription(new
AS400Text(29), "FILLER"); //48-53
     PackedDecimalFieldDescription poAmount = new
PackedDecimalFieldDescription(new AS400PackedDecimal(6,2),"POAMT"); //54-59


     QSYSObjectPathName POfilePathName  = new QSYSObjectPathName("QS36F",
"AB.PO","FILE");
     POFile = new KeyedFile(system, POfilePathName.getPath());
     AS400FileRecordDescription recDesc = new
AS400FileRecordDescription(system,
POfilePathName.getPath());
     try {
          RecordFormat recFormat = new RecordFormat("YB.PO@");
          recFormat.addFieldDescription(deleteCode);
          recFormat.addFieldDescription(PONumber);
          recFormat.addFieldDescription(subRecord);
          recFormat.addFieldDescription(accountNumber);
          recFormat.addFieldDescription(vendorNumber);
          recFormat.addFieldDescription(filler1);
          recFormat.addFieldDescription(poAmount);

          // set up keys
          recFormat.addKeyFieldDescription("PONO");
          recFormat.addKeyFieldDescription("POSUB");

          POFile.setRecordFormat(recFormat);


and :

try {
          POFile.open(AS400File.READ_ONLY, 0,
AS400File.COMMIT_LOCK_LEVEL_NONE);
          Object[] key = new Object[] {tranPONumber};
          Record record = POFile.read(key);
          if (record != null) {
               System.out.println((String)record.getField("PONO"));
          }
          POFile.close();


It never seems to find the key, even when I am sure that the tranPONumber
that I
am seeking does exist in the file.

I am getting desperate.  Can anybody see a glaring error in the code, or
maybe
somebody has an example of accessing a keyed data file when you have to
describe
your own record format?

Thank you,
Amy


_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.







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.