Log Search API

This API retrieves information by searching candidate log records that satisfy the search criteria from the Send Log, the Receive Log, the Observe Log, or the Schedule Log.

For details on the log file format, refer to Log file format.

Syntax

INT __stdcall  hulrlog( CHAR cLogType , CHAR cStatus , CHAR cReadMode , 
               LPCSTR lpszVersion , LPCSTR lpszFileID , LPCSTR lpszHostName , 
               CHAR cSearch , LPCSTR lpStartDate , LPCSTR lpStartTime , 
               LPCSTR lpEndDate , LPCSTR lpEndTime , LPSTR lpData , 
               INT nMaxNum , INT* lpMatchNum );

Explanation of the parameters

CHAR cLogType (IN)

Specify the type of log to search

S:

Send Log

R:

Receive Log

O:

Observe Log

C:

Schedule Log

CHAR cStatus (IN)

Specify the status classification

A:

All the log records are targeted and searched

N:

Search for only log records for transfers that successfully ended

E:

Search for only log records for transfers where errors occurred

CHAR cReadMode (IN)

Specify the search order

N:

Search log records in order from oldest to newest

R:

Search log records in order from newest to oldest

LPCSTR lpszVersion (IN)

Specify the version information of HULFT in the log format to be output

Specify one of the following:

  • V06L00

  • V06L01

  • V06L03

  • V07L00

  • V08L00

  • V08L01

  • V08L04

LPCSTR lpszFileID (IN)

Specify the file ID, service name, or schedule ID to be searched for

Specify the file ID as a character string within 50 bytes.

To omit this parameter, specify the value '0x00' as the first byte, or specify 'NULL' as a pointer.

LPCSTR lpszHostName (IN)

Specify the host name to search for

Specify the host name as a character string within 68 bytes.

To omit this parameter, specify the value '0x00' as the first byte, or specify 'NULL' as a pointer.

CHAR cSearch (IN)

Reserved for future use

Be sure to specify 'E.'

LPCSTR lpStartDate (IN)

Specify the start date of the search range

Specify the date as a character string of 8 bytes. Specify the character string in the date format such as YYYYMMDD. The date format must be the same as Date Format (datefmt) that is specified in the System Environment Settings. For details, refer to Administration Manual.

To omit this parameter, specify the value '0x00' as the first byte, or specify 'NULL' as a pointer.

LPCSTR lpStartTime (IN)

Specify the start time of the search range

Specify the time as a character string of 6 bytes. The format is HHMMSS.

You cannot specify this parameter if the start date is omitted.

To omit this parameter, specify the value '0x00' as the first byte, or specify 'NULL' as a pointer.

LPCSTR lpEndDate (IN)

Specify the end date of the search range

Specify the date as a character string of 8 bytes. Specify the character string in the date format such as YYYYMMDD. The date format must be the same as Date Format (datefmt) that is specified in the System Environment Settings. For details, refer to Administration Manual.

To omit this parameter, specify the value '0x00' as the first byte, or specify 'NULL' as a pointer.

LPCSTR lpEndTime (IN)

Specify the end time of the search range

Specify the time as a character string of 6 bytes. The format is HHMMSS. You cannot specify this parameter if the end date is omitted.

To omit this parameter, specify the value '0x00' as the first byte, or specify 'NULL' as a pointer.

LPSTR lpData (OUT)

Specify a pointer that shows the buffer where the search results are stored

Before hulrlog() is called, an array whose size is calculated by the formula 'Max. Retrieval Cases x (record length + 1)' must be allocated for a buffer.

The various dates of the acquired information are converted into the format that is set for Date Format in the System Environment Settings. The converted dates are stored in the buffer as the image of the log file format.

When multiple log records are obtained, they are separated by a delimiter (0x0a).

The output format of the log record is different according to the version information specified for lpszVersion. For the log file format and the record length of each version, refer to Log file format.

INT nMaxNum (IN)

Specify the Max. Retrieval Cases

Specify a value of 1 or more.

INT* lpMatchNum (OUT)

Specify the pointer that shows the buffer where the number of searched records is stored

Returned Values

0:

Search successful and complete

1:

Search successful but records remain

2:

No relevant information

3:

Parameter error

4:

Log file access error

5:

Memory error

6:

Security error

7:

Null pointer error

98:

Forced termination

99:

System error

Note

If you specify a search range for lpStartDate, lpStartTime, lpEndDate, or lpEndTime, the combinations of the log to be searched and the date or time used as a search key are as follows:

Table 7.2 Date or time used as search key

Log to Be Searched

Date or Time Used as Search Key

Send Log

Send End Date and Time

Receive Log

Receive End Date and Time

Observe Log

Observed Date and Time

Schedule Log

End Date and Time

<Usage example>

Specifying settings when using Visual C++

#include <windows.h>
#include <stdio.h>

typedef INT(__stdcall *LPHULRLOG)( 
    CHAR cLogType, CHAR cStatus, CHAR cReadMode, 
    LPCSTR lpszVersion, LPCSTR lpszFileID, 
    LPCSTR lpszHostName, CHAR cSearch, LPCSTR lpStartDate, 
    LPCSTR lpStartTime, LPCSTR lpEndDate, LPCSTR lpEndTime, 
    LPSTR lpData, INT nMaxNum, INT *lpMatchNum); 

int main() 
{ 
    CHAR cLogType; 
    CHAR cStatus; 
    CHAR cReadMode; 
    CHAR szVersion[6 + 1]; 
    CHAR szFileID[50 + 1]; 
    CHAR szHostName[68 + 1]; 
    CHAR cSearch; 
    CHAR szStartDate[8 + 1]; 
    CHAR szStartTime[8 + 1]; 
    CHAR szEndDate[8 + 1]; 
    CHAR szEndTime[8 + 1]; 
    CHAR szData[(4862 + 1) * 10]; 
    INT nMaxNum; 
    INT nMatchNum; 
    HMODULE hHulDll; 
    HMODULE hApiDll; 
    LPHULRLOG lpHulrlog; 
    INT nStatus; 

    cLogType = 'S'; 
    cStatus = 'E'; 
    cReadMode = 'R'; 
    strcpy_s(szVersion, sizeof(szVersion), "V08L04"); 
    strcpy_s(szFileID, sizeof(szFileID), "TEST0001"); 
    strcpy_s(szHostName, sizeof(szHostName), ""); 
    cSearch = 'E'; 
    strcpy_s(szStartDate, sizeof(szStartDate), "20180801"); 
    strcpy_s(szStartTime, sizeof(szStartTime), "120000"); 
    strcpy_s(szEndDate, sizeof(szEndDate), "20180802"); 
    strcpy_s(szEndTime, sizeof(szEndTime), "120000"); 
    memset(szData, 0x00, sizeof(szData)); 
    nMaxNum = 10; 
    nMatchNum = 0; 

    hHulDll = LoadLibrary("C:\\HULFT Family\\hulft8\\bin\\hulftrt.dll"); 
    if (hHulDll == NULL) { 
        printf("Unable to load hulftrt.dll." 
            "(Error code = %lu)\n", GetLastError()); 
        return 1; 
    } 
    hApiDll = LoadLibrary("C:\\HULFT Family\\hulft8\\bin\\hulapi.dll"); 
    if (hApiDll == NULL) { 
        printf("Unable to load hulapi.dll." 
            "(Error code = %lu)\n", GetLastError()); 
        FreeLibrary(hHulDll); 
        return 2; 
    } 
    lpHulrlog = (LPHULRLOG)GetProcAddress(hApiDll, "hulrlog"); 
    if (lpHulrlog == NULL) { 
        printf("Unable to retrieves the address of HULFT API." 
            "(Error code = %lu)\n", GetLastError()); 
        FreeLibrary(hApiDll); 
        FreeLibrary(hHulDll); 
        return 3; 
    } 

    nStatus = lpHulrlog(cLogType, cStatus, cReadMode, szVersion, 
        szFileID, szHostName, cSearch, szStartDate, 
        szStartTime, szEndDate, szEndTime, 
        szData, nMaxNum, &nMatchNum); 
    if (0 <= nStatus && nStatus <= 2) { 
        printf("%d number were searched.\n", nMatchNum); 
    } else { 
        printf("Error occurred when calling HULFT API." 
            "(Returned value = %d)\n", nStatus); 
    } 

    FreeLibrary(hApiDll); 
    FreeLibrary(hHulDll); 
    return 0; 
}