![[About]](r:\html\lsrxabout.gif)
![[Toc]](r:\html\lsrxtoc.gif)
0.9b (c) 1995 Peter Childs
The function returns read enries from the error log.
Syntax
MyRc = NetMisc(NETERRORLOGREAD, 'errInfo', SrvName)
Parameters
The parameters required and returned are:
'errInfo' The error information and control variable, which is divided
into:
o errInfo.openflags
The read operation control flags. The values controlling the read
operation are:
Value Read direction
----- --------------
0 Read the oldest records in the error log first
1 Read the newest records first
Value Record read options
----- -------------------
0 Read sequentially from the beginning
2 Read from the nth. record specified
in the errInfo.offset parameter
A value of 3 for this variable is identical to read the newest
records first and read from the record number as specified in the
errInfo.offset parameter errInfo.openflags
The default value is 0 which is identical to read the oldest records
first and read sequentially
o errInfo.offset
This parameter specifies the record number the read operation should
be starting from. It requires that the errInfo.openflags has the
value 2 included
o errInfo.buffer
The size of the internal working buffer. The value has a maximum of
64KB. The default value is 4KB.
o errInfo.resume
The error log can be processed in multiple steps. Specify
'INITRESUME' first time and 'RESUME' in next following calls to the
procedure. See also errInfo.bytesavail
The default operation is to neglect this parameter
o errInfo.bytesavail
The errInfo.bytesavail variable returns information about the amount
if data available. It is only valid if errInfo.resume is specified.
If errInfo.bytesavail is not 0, then more data is available in the
error log. Continue to call the function with errInfo.resume equal to
'RESUME' until the parameter errInfo.bytesavail returns a 0 value
o errInfo.count
The number of error log entries returned. The value can be 0
o errInfo.i.time
The time as the error log entry i was inserted to the log file
o errInfo.i.errcode
The error code reported in the log file
o errInfo.i.component
The reporting component
o errInfo.i.nstrings
The number of text strings related to the error log entry i
o errInfo.i.string.n
The nth text string for the error log entry i
o errInfo.i.rawlength
The associated raw data length. This value will be 0 is now raw data
is associated to the error log entry i
o errInfo.i.rawdata
The raw data available. This variable is valid only if
errInfo.i.rawlength is different from 0
SrvName The computer name of the server to perform the operation on.
Use the value '' for a local computer
Example
/* Read error log entries on server */
call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
call LoadLsRxutFuncs
NETERRORLOGREAD = 650
SrvName = '\\DOMAIN_CONTRLR'
myRc = NetMisc(NETERRORLOGREAD, 'errInfo', SrvName)
if myRc <> '0' then do
say 'Got error from NetMisc() ' myRc
exitRc = 9
end
else do
say 'Bytes available: ' errInfo.bytesavail
say 'Number of entries:' errInfo.count
do i = 1 to errInfo.count
say
say 'Time: ' errInfo.i.time
say 'Error Code: ' errInfo.i.errcode
say 'Component: ' errInfo.i.component
say 'Text strings: ' errInfo.i.nstrings
if errInfo.i.nstrings <> 0 then do
do j = 1 to errInfo.i.nstrings
say 'String text: ' errInfo.i.string.j
end
end
say
say 'Raw data length:' errInfo.i.rawlength
if errInfo.i.rawlength <> 0 then do
do j = 1 to 5
say C2X(substr(errInfo.i.rawdata,j,1))
end
end
end
exitRc = 0
end
call DropLsRxutFuncs
call RxFuncDrop 'LoadLsRxutFuncs'
exit exitRc
Example Output
Bytes available: 0 Number of entries: 1 Time: Mon Sep 5 13:14:01 1994 Error Code: 99 Component: MY_PROC_1 Text strings: 2 String text: Error occurred in function error handler String text: The server computer name was not specified Raw data length: 32 00 01 02 03 04
Example using RESUME operation and record offset
/* Read error log entries on server using RESUME operation */
call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
call LoadLsRxutFuncs
NETERRORLOGREAD = 650
SrvName = ''
entries = 0
errInfo.resume = 'INITRESUME'
errInfo.buffer = 512
errInfo.openflags = 2
errInfo.offset = 145
SrvName = '\\DOMAIN_CONTRLR'
call theProc
if errInfo.bytesavail <> 0 then do
errInfo.resume = 'RESUME'
errInfo.openflags = 0 /* This must be 0 or myRc=2440 */
do while errInfo.bytesavail <> 0
call theProc
end
end
call DropLsRxutFuncs
call RxFuncDrop 'LoadLsRxutFuncs'
exit exitRc
/*************************/
/* Get error log entries */
/*************************/
theProc:
myRc = NetMisc(NETERRORLOGREAD, 'errInfo', SrvName)
if myRc <> '0' then do
say 'Got error from NetMisc() ' myRc
exitRc = 9
call DropLsRxutFuncs
call RxFuncDrop 'LoadLsRxutFuncs'
exit exitRc
end
else do
say 'Bytes available: ' errInfo.bytesavail
say 'Number of entries:' errInfo.count
do i = 1 to errInfo.count
say
say 'Time: ' errInfo.i.time
say 'Error Code: ' errInfo.i.errcode
say 'Component: ' errInfo.i.component
say 'Text strings: ' errInfo.i.nstrings
if errInfo.i.nstrings <> 0 then do
do j = 1 to errInfo.i.nstrings
say 'String text: ' errInfo.i.string.j
end
end
say
say 'Raw data length:' errInfo.i.rawlength
if errInfo.i.rawlength <> 0 then do
do j = 1 to 5
say C2X(substr(errInfo.i.rawdata,j,1))
end
end
end
exitRc = 0
end
return
Inf-HTML End Run - Successful