|
Since you're not doing any transforms and not setting the required attributes in the PrintParameterList, it seems like you'd be better off with a PrintObjectInputStream rather than a PrintObjectTransformedInputStream. You can obtain this with objSpoolFile.getInputStream() If it still doesn't work, can you examine or print out objSpoolByte (in hex) and intInputStreamSize? Also, can you please assign the return value of objInputStream.read(objSpoolByte) to an int and print out the value of that int? Gary > -----Original Message----- > From: java400-l-bounces@xxxxxxxxxxxx > [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Wills, > Mike N. (TC) > Sent: Tuesday, December 23, 2003 8:40 AM > To: Java Programming on and around the iSeries / AS400 > Subject: Converting from EBCDIC to ASCII > > > I have a question I am in the process of debugging a program > that is bombing out on us. I did not write it, but I am > debugging it. It looks like it is using something in the > JT400 to convert the text, but it doesn't seem to work 100% right. > > Here is the string being converted (from a spool file): > 0 0.00 0 0.00 156 0.02 SALES & MARKETING SERVICES 72 > 0.00 0 > 0.00 2,337 0.02 > > Here is what it looks like after the conversion (in ASCII): > 0 0.00 0 0.00 156 0.02 SALES & MARKETING SERVICES 72 > 0.00 0 > 0.00 2,337 0.0% > > Why would it do this? > > Here is the conversion code: > private String ReadFile() throws AS400SecurityException, > AS400Exception, > > IOException, > > ErrorCompletingRequestException, > InterruptedException, > > RequestNotSupportedException { > String strConvertedFile=""; > AS400 objAS400 = new AS400(_AS400,_UserName,_Password); > SpooledFile objSpoolFile = new SpooledFile(objAS400, > _SpoolFileName, > _SpoolFileNumber, > > _SpoolFileJobName , > > _SpoolFileUserName, > > _SpoolFileJobNumber ); > PrintParameterList objPPL = new PrintParameterList(); > PrintObjectTransformedInputStream objInputStream; > objInputStream = > objSpoolFile.getTransformedInputStream(objPPL); > int intInputStreamSize = objInputStream.available(); > > byte[] objSpoolByte = new byte[intInputStreamSize]; > objInputStream.read(objSpoolByte); > AS400Text textConverter = new > AS400Text(intInputStreamSize,37); > strConvertedFile = ((String) > textConverter.toObject(objSpoolByte)); > objInputStream.close(); > objAS400.disconnectAllServices(); > return strConvertedFile; > } > > My thought is either a bug in the JT400 (I don't know which > version we have, we are on V5R2), or it is a problem with the > spool file. I am going to have the person create a new spool > file to see if this still has the problem. > > Just to warn you, I am not a java guru. I just know enough to > be dangerous. > > Mike Wills > Lawson Programmer/Administrator > Taylor Corporation > Email: mnwills AT taylorcorpNOSPAM DOT com > AIM: iSeriesCodePoet _______________________________________________ > This is the Java Programming on and around the iSeries / > AS400 (JAVA400-L) mailing list To post a message email: > JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change > list options, > visit: http://lists.midrange.com/mailman/listinfo/java400-l > or email: JAVA400-L-request@xxxxxxxxxxxx > 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 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.