ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Will Using Java.IO.File cause data to scramble on the 400 IFS?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Will Using Java.IO.File cause data to scramble on the 400 IFS?

    I am building a small java application that will take in XML files and convert them to text files. The end result being a jar that sits on the IFS to convert files when called from a shell script run by a RPGLE program.

    To do so I am using JAXB to unmarshall these XML files into JAXB annotated POJOS before putting them into a text file using the a new IFSFile and IFSFileOutputStream. This works great with the exception that the order output data is scrambled or out of its proper order.

    I created a second version of the Jar that replaced the IBM Toolbox classes for standard Java.IO classes. This version of the jar when run from Windows outputs the results in the proper order. This same Jar (Java.IO version) run from the 400 itself returns scrambled data too.

    Both Jars however use a standard Java.IO file for the XML inputs. This is because JAXB will not accept an IFSFile as an input. See the below code:

    Code:
                File inputFile = new File(source);
                JAXBContext context = JAXBContext.newInstance(PriceRecords.class);
                Unmarshaller unmarshaller = context.createUnmarshaller();
    
                PriceRecords priceRecords = (PriceRecords) unmarshaller.unmarshal(inputfile);
                List<PriceRecord> data = priceRecords.getPriceRecords();
    I read somewhere that the AS400s save/read files differently than a standard Linux or Windows OS would. So I am wondering if someone can shed some light on this. And if the scrambled data isn't caused by the above inputFile being the Java.IO.File class used on a AS400 what else could cause this difference in functionality?
Working...
X