I am extracting several tests worth of data from 1 file to separate formatted files. The first file is formatted correctly with the Header on the top on the 1st page and the form feed after $= lines. The following output files do not print the header on the first page or insert a form feed after my $= lines (it starts to work from page 2 on).
open (BZF, "< $bzWdF") or die "$!\n"; binmode(BZF); # Read file in binary mode read(BZF, $rcrd1, $BytPrRcrdBZF) == $BytPrRcrdBZF; @tstsLocat = unpack(" n32 ", $rcrd1); for (my $tstcnt=1;$tstcnt<=$tstsLocat[0];$tstcnt++){ seek(BZF, $tstS, 0) or die "seek:$!"; ## Build Performance Data HOH. $validTst= buildTblEntry($tblEnt,$tstcnt); if ( $validTst ==1){ my $outF= $tblEnt.".txt"; open (OUTF, "> $outF") or die "$outF $!\n"; my $ofh = select(OUTF); $% = 0; $= = 59; ## Print report Performance Data Sheet &prntRptPerfmanceSheet($tblEnt); ## Loop thru Equipment List entries for(my $eq1b_a="",my $eq1b_n=0; $doneEq!=1;){ read(BZF, $rcrd1, $BytPrRcrdBZF) == $BytPrRcrdBZF or die "shor +t read EQ\n"; $eq1b_a= unpack(" A2 ", $rcrd1); $eq1b_n= unpack(" n ", $rcrd1); last if(($eq1b_a eq 'XX') || ( $eq1b_n == 0xFFFF)); #XX indica +tes end of entries ## Print report Equipment List $doneEq = prntHdEQ($tblEnt); $~ = "BLANK_LINE";write; } ##Setting up Line Item Table & Message Table files and Info open (LIT, "< $tPI{$tblEnt}{litbl}") or die "Error opening Line Item Table: $!\n"; open (MST, "< $tPI{$tblEnt}{mstbl}") or die "Error opening Message Table: $!\n"; binmode(LIT); # Read Line Item table in binary mode binmode(MST); # Read Message Table in binary mode getLItTblInfo($tblEnt); getMsgTblInfo($tblEnt); ## Loop thru Data entries in BZ file for current test run for(my $doneData=0; (tell BZF)<$tstE; ){ read(BZF, $rcrd1, $BytPrRcrdBZF) == $BytPrRcrdBZF or die "shor +t read Data\n"; last if (unpack(" n ", $rcrd1) == 0xFFFF); #FF indicates end o +f data segment ## Print report Data $doneData= bZData($tblEnt); last if $doneData; } &page; #print blank lines till $- =0; $%=0; #TRying to clean up for next test $-=0; #TRying to clean up for next test select($ofh); close OUTF; } } close BZF or die "Could close file $!\n"; }

In reply to Format _top by patmcl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.