
trento
New User
Jan 24, 2010, 1:54 AM
Post #1 of 3
(365 views)
|
|
write with format: what is the order
|
Can't Post
|
|
Hi, all 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 PPE HEADER DETL 1 DETL 2 DETL 3 SUBTOTALS DETL 4 DETL5 SUBTOTALS GRANDTOTALS 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 Trent
(This post was edited by trento on Jan 24, 2010, 2:02 AM)
|