|
Hey all, I'm at my wits end...I need to have a flat physical file on our as400 be put to a flat text file on the same 400... I'm trying stuff in Java but I keep getting garbage in my .txt file...here's my code: public static void getEmployees() { try { IFSFileOutputStream fos = new IFSFileOutputStream(nal820, "/HighJump/employees.txt"); Writer out = new OutputStreamWriter(fos, "UTF8"); CharacterFieldDescription employee = new CharacterFieldDescription(new AS400Text(51, nal820), "EMPLOYEE"); RecordFormat hjemptRF = new RecordFormat("RHJEMPT"); hjemptRF.addFieldDescription(employee); QSYSObjectPathName fileName = new QSYSObjectPathName("ASCLIB", "HJEMPT", "FILE"); SequentialFile file = new SequentialFile(nal820, fileName.getPath()); file.setRecordFormat(hjemptRF); file.open(SequentialFile.READ_ONLY, 10, SequentialFile.COMMIT_LOCK_LEVEL_NONE); Record data = file.readNext(); while (data != null) { out.write((String)data.getField("EMPLOYEE") + "\r\n"); data = file.readNext(); } out.close(); } catch (AS400SecurityException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (java.beans.PropertyVetoException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (AS400Exception e) { e.printStackTrace(); } } every time I run this and open employees.txt, it's garbage...is there a certain CCSID I should use or am I going about this completely wrong? Shane
As an Amazon Associate we earn from qualifying purchases.
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.