Stat1

stat1 is a system variable that contains the number of lines returned by a System instruction.

Syntax

 [S]stat1stat1

Examples

# On an Unix system, let's list a returned as parameterSubprog DIRECTORY_LIST(DIRECTORY,RESULT,NBLINES,PARTIAL)Value Char DIRECTORY()Variable Char RESULT()(1..)Variable Integer NBLINESVariable Tinyint PARTIAL: # Set to 1 if only a partial result is returnedLocal Integer ISystem RESULT="ls -l"-DIRECTORYNBLINES=stat1PARTIAL=(NBLINES>dim(RESULT))End

Description and comments

When performing a System order on one of the servers available, the standard output can be captured by using the syntax System VARIABLE_ARRAY=SYSTEM_ORDER. The number of lines returned by the system order is returned in stat1.

This value can exceed the dimension of the array that returns the result. Only the first returned lines are stored in the array, and the value of stat1 is greater than the dimension of the array.

Associated errors

No error is returned, but if the System order fails, a negative value can be returned in stat1 (for example, the error status returned by the shell that executed the system instruction on Unix).

See also

System.