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.
InFileHandle = ifsOpen(%str(inFilePtr):'rb');
Open input file.
OutFileHandle = ifsOpen(%str(outPathName):'w,o_ccsid=819');
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.