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



Hello all,

I am trying to access the text values for field descriptors, but cannot
seem to do so. I have very little (essentially none) experience with
iSeries and RPG, and am trying to interface a Java program on top of
legacy code. I am using the Java code as below:

import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400FileRecordDescription;
import com.ibm.as400.access.FieldDescription;
import com.ibm.as400.access.KeyedFile;
import com.ibm.as400.access.RecordFormat;

public class TestFile {

public static void main(String[] args) throws Exception {
AS400 system = new AS400();

final String PATH = "/QSYS.LIB/TMSV8DTA.LIB/CCAREF.FILE";
KeyedFile keyedFile = new KeyedFile(system, PATH);
AS400FileRecordDescription recordDescription = new
AS400FileRecordDescription(system, PATH);
RecordFormat[] format =
recordDescription.retrieveRecordFormat();
keyedFile.setRecordFormat(format[0]);
FieldDescription[] fieldDescriptions =
format[0].getFieldDescriptions();
for (FieldDescription fieldDescription :
fieldDescriptions) {
//I have also tried getCOLHDG() in addition to
getTEXT(); neither of these return any text.
System.out.println("Field '" +
fieldDescription.getFieldName() + "' = Text '" +
fieldDescription.getTEXT() + "'");
}
keyedFile.close();

system.disconnectAllServices();

System.exit(0);
}
}


I get results as follows:

Field 'DLCD24' = Text ''
Field 'TRIP24' = Text ''
Field 'BGDT24' = Text ''
....

I have confirmed that the file contains the correct field data. Below is
an excerpt from dspffd, run against the same file as I am accessing in
Java. Note that both Column Heading and Field Text are set (to "DELETE
CODE"):

Field Level Information
Data Field Buffer Buffer Field Column
Field Type Length Length Position Usage Heading
DLCD24 CHAR 1 1 1 Both DELETE
CODE
Field text . . . . . . . . . . . . . . . : DELETE CODE
Coded Character Set Identifier . . . . . : 37

In theory, when running my Java test, I should get the result:

Field 'DLCD24' = Text 'DELETE CODE'


Can anyone see what I may be doing wrong in my test Java class?

Thanks in advance for any and all help!

Cheers
--Wyatt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.