I am trying to write data from one stream file to a text file. Stream file is a big file of 5000 pages and i am generating 5 text files with 1000 pages . Now when i write first 1000 pages to file1.txt it writes perfectly well . Now when 1000 pages are reached i close that file and open a new file file2.txt and start writing to file file2.txt from page 1001 to 1002 and so on. Now from file2.txt onwords my data is not getting aligned correctly.It is writing data with prior 5-6 spaces .I am not sure why this is happening . Is it due to some buffer problem or some junk data ? Do i have to clear buffer before writing data as when i am generating one complete text file of 5000 all the data is getting aligned perfectly well.
code :
InFileHandle = ifsOpen(%str(inFilePtr):'rb');
Open input file.
OutFileHandle = ifsOpen(%str(outPathName):'w,o_ccsid=819');
IFSClose(OutFileHandle);
make ccsid 819 to make it windows compatible
OutFileHandle = ifsOpen(%str(outPathName):'w');
Now everytime when i am generating new files i am closing first and opening new with the same input and output handles. Please suggest ! Help will be highly appreciated.
Software/Hardware used:
as400
ASKED:
November 3, 2012 3:58 PM
UPDATED:
November 5, 2012 1:34 PM
The opens and closes aren’t useful by themselves. We need to see the reads and writes and the logic that controls them. We don’t know if buffers need to be cleared nor anything else until we see how they are defined and used. Can you show more code? — Tom
strange .. how did you create the “text” files?
no, forget that question.