Forcing format to print top of page 
Author Message
 Forcing format to print top of page

Hello:

I am creating a report which should print the top of page every time
the id changes, regardless of the number of lines used.

Here is the code.  Can you please point out my mistake?  Thanks for
your help!

gavs.

#!/usr/bin/perl

$= = 45;

while (fetching results from db) {

 if ($new_id != $cur_id) {
      $new_id = $cur_id;
      ##$% = 46;
      $- = 0;
   }

write(OUTFILE);

Quote:
}

format OUTFILE_TOP=
.
.
.

format OUTFILE=
.
.
.

close OUTFILE;



Sat, 27 Aug 2005 22:16:30 GMT  
 Forcing format to print top of page


Quote:
> Hello:

> I am creating a report which should print the top of page every time
> the id changes, regardless of the number of lines used.

> Here is the code.  Can you please point out my mistake?  Thanks for
> your help!

> gavs.

> #!/usr/bin/perl

> $= = 45;

> while (fetching results from db) {

>  if ($new_id != $cur_id) {
>       $new_id = $cur_id;
>       ##$% = 46;
>       $- = 0;
>    }

> write(OUTFILE);
> }

> format OUTFILE_TOP=
> .
> .
> .

> format OUTFILE=
> .
> .
> .

> close OUTFILE;

Your pseudo code is correct.  I suspect that the if block is never
executed due to an error in the code that you have not shown.
(Temporarily add a print statement to the if block to check this.)  I
probably could be of more help if you provided a small working program
that demonstrates the problem.

I usually advise against using write/format because it is difficult and
not well documented.  Your use of headers may well be an exception where
the benefit is worth the pain.

Good Luck,
Bill



Sun, 28 Aug 2005 03:17:34 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. variables in top-of-page formats

2. Top-of-page format: STDOUT_TOP??

3. Format for top of page; adding system date

4. Top of the page format problem

5. Top-of-page format

6. Question on top of page format

7. Top of Page Printing

8. write() not printing TOP format

9. format print produces blank pages

10. **FORMAT Formatting columns/pages

11. Printing in format statments using e/g format

12. FORMAT: printing non-printing characters

 

 
Powered by phpBB® Forum Software