getFirst

>>--getFirst(--+---------+-+----------+--)----------------------><
               +--server-+ +-,-source-+

Determines the absolute record number of the first record in the event log.

Arguments:

The arguments are:

server

Optional. The server where the event log resides.

source

Optional. The event source.

Return value:

On success, the first record number in the event log. On error, the return is the negated system error code.

Example:

This example displays the first record written to the application log.

It is somewhat interesting to note that this first record was written right after the operating system had been installed, prior to the computer being added to a work group and given the Osprey name. This can be seen when the record is displayed, the Computer field is MACHINENAME.


  log = .WindowsEventLog~new~~open("\\Osprey", "System")
  log~readRecords( , , , log~getFirst, 1)
  rec = log~events[1]
  if rec \== .nil then do

    parse var rec type date time "'" src"'" id user computer "'" string "'" "'" data "'"
    say 'Type     : 'type
    say 'Date     : 'date
    say 'Time     : 'time
    say 'Source   : 'src
    say 'ID       : 'id
    say 'UserId   : 'user
    say 'Computer : 'computer
    say 'Detail   : 'string
    say 'Data     : 'data
  end

::requires 'winSystm.cls'

/* Output might be:

Type     : Information
Date     : 08/16/08
Time     : 04:27:01
Source   : EventLog
ID       : 6009
UserId   : N/A
Computer : MACHINENAME
Detail   : 5.02. 3790 Service Pack 1 Multiprocessor Free
Data     :

*/