Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PL/I Calling SYS$FORMAT_AUDIT To Format Binary Audit File
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1993. All rights reserved
PRODUCT:    VAX PL/I Version 3.5

OP/SYS:     OpenVMS VAX Versions 5.0, 5.0-1, 5.0-2, 5.1, 5.1-B, 5.1-1,
                                 5.2, 5.2-1, 5.3, 5.3-1, 5.3-2, 5.4,
                                 5.4-1, 5.4-2, 5.4-3, 5.5, 5.5-1,
                                 5.5-2, 6.0

SOURCE:     Digital Customer Support Center


OVERVIEW:

This article demonstrates how to call SYS$FORMAT_AUDIT to format
audit records in a binary audit file.


*** CAUTION ***

This sample program has been tested using VAX PL/I V3.5 on OpenVMS
VAX V6.0.  However, we cannot guarantee its effectiveness because of
the possibility of error in transmitting or implementing it.  It is
meant to be used as a template for writing your own program, and it
may require modification for use on your system.


PROGRAM NOTES:

To create a binary audit file, execute the command

  $ ANALYZE/AUDIT/BINARY audit_filename output_filename

To find out the system audit file name, use the SHOW AUDIT/ALL command.
Security privilege is required to execute this command.  This file will
be opened and read by the program, and the records formatted by
SYS$FORMAT_AUDIT.

*** NOTE ***

There is a problem with the definition of SYS$FORMAT_AUDIT in the
PLI$STARLET.TLB file.  See the article in this database entitled:

  [VAX PL/I]  Definition For SYS$FORMAT_AUDIT Is Incorrect In PLI$STARLET

for the solution/workaround for this problem.


PROGRAM:

test : PROCEDURE OPTIONS( MAIN );

  %REPLACE TRUE BY '1'B;
  %REPLACE FALSE BY '0'B;

  %INCLUDE $nsadef;
  %INCLUDE $stsdef;
  %INCLUDE sys$format_audit;

  DECLARE eof               BIT(1) ALIGNED INITIAL( FALSE );

  DECLARE audit_journal     FILE;
  DECLARE audit_rec         CHARACTER(512) VARYING;
  DECLARE audmsg            CHARACTER(512) INITIAL(' ');
  DECLARE output_length     FIXED BINARY(15) INITIAL(0);
  DECLARE output_buffer     CHARACTER(1024) INITIAL (' ');
  DECLARE width             FIXED BINARY(15) INITIAL(132);
  DECLARE terminator        CHARACTER( 2 ) INITIAL( BYTE(13) || BYTE(10) );

  /* Set up error handling for input audit journal file */
  ON UNDEFINEDFILE ( audit_journal ) BEGIN;
    PUT SKIP EDIT ( 'Error, raw audit log file not found.' ) (A);
    GOTO clean_up;
  END; /* on */

  ON ENDFILE ( audit_journal ) eof = TRUE;

  /* Open input audit journal (binary) file create from ANALYZE/AUDIT/BINARY
     command */
  OPEN FILE ( audit_journal ) SEQUENTIAL INPUT
    TITLE ( 'AUDIT_OUTPUT.DAT' )
    ENVIRONMENT( SHARED_WRITE );

  /* Read in first record */
  READ FILE ( audit_journal ) INTO ( audit_rec );
  audmsg = audit_rec;

  /* loop until end of audit journal */
  DO WHILE ( ^eof );

    /* Call system service to format binary data into text */
    sts$value = sys$format_audit( nsa$c_format_style_brief,
                                  audmsg,
                                  output_length,
                                  output_buffer,
                                  width,
                                  terminator,
                                  ,
                                  );
    IF ^sts$success THEN
      SIGNAL VAXCONDITION( sts$value );

    PUT SKIP LIST( output_buffer );

    READ FILE ( audit_journal ) INTO ( audit_rec );
    audmsg = audit_rec;

  END; /* while */

  clean_up:

  CLOSE FILE ( audit_journal );

END test;



REFERENCES:

"OpenVMS System Services Reference Manual", May 1993, (AA-PV6FA-TK),
  pages SYS1-319 to SYS1-322.



buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms