Jan 24, 2010, 1:54 AM
Post #1 of 3
write with format: what is the order
I have some formatted reports consisted of HEADER, DETAIL, SUB_TOTALS, GRAND_TOTALS lines.
In my file could be several breaks by key, so could be several groups of DETL+SUB_TOTALS groups and because of page breaks could be several number of HEADERs lines.
I just can not understand why I see my records in different order iin result file then they were executed in script, it appeared that they are in the order how I closed my files at the end of script.
For now I open all filehandles once and close them once at the end. All my <format > handles point to the same file with >>:
open (OUT_PRE, '>>spool.dat');
open (OUT_HEADER, '>>spool.dat');
open (OUT_DETL, '>>spool.dat');
open (OUT_GRANDTOTALS, '>>spool.dat');
open (OUT_SUBTOTALS, '>>spool.dat');
Anybody can tell me how I can make my records in the spool.dat be in the same order my <write> executed along the program, i.e
Do you think I need every time before <write> open/close file? But I might have 1K+ of them during my execution, it will be killer for files..
Appreciate you help, 2am in CA and I still trying to get how I can make it work.
BTW: I'm on last ActivePerl installed on my XP'Pro laptop if it matters.
my test script is attached
Thanks to all
(This post was edited by trento on Jan 24, 2010, 2:02 AM)