This is an excerpt from my script.  In summary the script works like this

For each database ($database_name) listed in a string the script below should do
 the following (while loop)

open (AUDITREPORT, ">$database_name.txt") ;             # this generates a new
file name based on the database name
     @ary = fetch_db_row();                             # fetches a row of data
from the database
     while ($ary[0]) {
          write (AUDITREPORT);                     # write the results to the
file using the format
          @ary = fetch_db_row();                   # fetch another row of data
     }


format AUDITREPORT_TOP =
=========================================================================================================


                          Database Audit Report
                         ----------------------------
  OS_LOGIN     - Operating system login username of the user whose actions were
audited
  ACTION       - Audited command executed by USERNAME

  TIME_ISSUED  - The date/time of when the command was issued

=========================================================================================================
                              Page @<<
                                   $%

OS_LOGIN             ACTION   TIME_ISSUED
----------------------------------------------------------------------
.
format AUDITREPORT =
@<<<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<<<
$ary[0]           $ary[1]     $ary[2]
.



This script works fine, but only the first report filename contains the header
information ie. the definition in the _TOP portion of the format. The other
files contain
just the rows but no report header information. I was expecting the since a new
file is generated each time (based on the database name) each file should have
the header information written to it.

Would appreciate any pointers to what I am doing wrong.

Regards
Kwabena




_____________________________________________________

This transmission has been issued by a member of the HSBC Group 
"HSBC" for the information of the addressee only and should not be 
reproduced and / or distributed to any other person. Each page attached 
hereto must be read in conjunction with any disclaimer which forms part 
of it. Unless otherwise stated, this transmission is neither an offer nor the 
solicitation of an offer to sell or purchase any investment. Its contents are 
based on information obtained from sources believed to be reliable but
HSBC makes no representation and accepts no responsibility or liability as 
to its completeness or accuracy.

_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to