GET_FILESYSTEM returns 0 if there are more files than MAX_FILE_COUNT
search cancel

GET_FILESYSTEM returns 0 if there are more files than MAX_FILE_COUNT

book

Article ID: 422524

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

In v21 GET_FILESYSTEM returns the number of files or megabyte even if this number is higher than MAX_FILE_COUNT

This occurs for the functions:

  • PATH_FILE_COUNT
  • FILESYSTEM_SPACE_TOTAL
  • FILESYSTEM_SPACE_USED
  • FILESYSTEM_SPACE_FREE

In v24 these functions returns zero:

U00020408 0000000000000000

Cause

This is a functionality that never worked and that has been properly implemented in the Windows Java Agent.

Resolution

Workaround:

As in many UC4 script functions: if the return is 0 - the last-error must be checked.

Using the following script that catches the error number and message, will help to determine why the GET_FILESYSTEM function returns zero if the number of files exceeds MAX_FILE_COUNT.

The following UC4 script example shows this error routine for PATH_FILE_COUNT but it works in the same way for the FILESYSTEM_SPACE_[TOTAL | USED | FREE] sub functions :

:SET &NumberFiles# = GET_FILESYSTEM(<AGENT>, "<FOLDER>", PATH_FILE_COUNT)
:SET &ERRNR# = SYS_LAST_ERR_NR()
:IF &ERRNR# NE "0"
:   SET &ERRINS#  = SYS_LAST_ERR_INS()
:   SET &MESSAGE# = GET_MSG_TXT (&ERRNR#,&ERRINS#)
:   P &MESSAGE#
:   ELSE
:   P "Number of files ",&NumberFiles#
:ENDIF

Error:

2025-12-15 10:39:36 - U00020408 U02000121 File limit ('5') for file event ('4851007') has been exceeded.

Solution: 

Set MAX_FILE_COUNT=0 (unlimited) in the UC_HOSTCHAR_<AGENT> to keep the v21 behavior. This may have a performance impact.