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



David Gibbs wrote:
Anyone know if there is a way to generate RFML specifications from a
physical file object?

Found the solution ... it's actually built into JT400 :)

Here's an example ... http://code.midrange.com/index.php?id=a9d75e7e3a

Or ...
import java.io.IOException;

import com.ibm.as400.access.*;
import com.ibm.as400.data.*;

public class GenerateRfml {

        private static final String SYSTEM_NAME = "systemname";
        private static final String USERID = "userid";
        private static final String PASSWORD = "password";
        
        private static final String LIBRARY = "library";
        private static final String FILENAME = "file";
        
        private static final String OUTPUT_PREFIX = "/temp/" + FILENAME + "-";
        private static final String OUTPUT_SUFFIX = ".rfml";
        
        public void go() {
                
                AS400 as400 = new AS400(SYSTEM_NAME, USERID, PASSWORD);
                
                String path = QSYSObjectPathName.toPath(LIBRARY, FILENAME, 
"FILE");
                
                try {
                        AS400FileRecordDescription recordDescription =
                                new AS400FileRecordDescription(as400, path);
                        
                        RecordFormat[] formats = 
recordDescription.retrieveRecordFormat();
                        
                        for(int i=0;i<formats.length;i++) {
                                RecordFormatDocument doc = new 
RecordFormatDocument(formats[i]);
                                String formatName = formats[i].getName();
                                doc.toXml(OUTPUT_PREFIX + formatName + 
OUTPUT_SUFFIX);
                                
                        }
                } catch (AS400Exception e) {
                        e.printStackTrace();
                } catch (AS400SecurityException e) {
                        e.printStackTrace();
                } catch (InterruptedException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (XmlException e) {
                        e.printStackTrace();
                }
                
        }
        
        public static void main(String[] args) {
                GenerateRfml genRfml = new GenerateRfml();
                genRfml.go();
        }
}


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.