Rexx - Stream


Advertisements

This function is used to check the status of a file. Sometimes it is required to check the status of a file before it is used. If the file is corrupt or not available, then no further operations can be performed on the file. So it makes more sense to first check the status of the file.

Syntax

stream(filename) 

Parameters

filename − This is the name of the file.

Return Value

This function can return any of the following values −

  • READY − The file is ready and can be used for any subsequent operations.

  • NOTREADY − The file is not ready. There could be cases wherein the file is being used by another operation and waiting for waiting for an input/output operation to occur. In such cases, the file might have this status.

  • ERROR − There could be cases wherein the file is being used by another operation and the file could be in an error state. In such cases, the file might have this (ERROR) status.

  • UNKNOWN − This is returned wherein Rexx cannot understand what is the current status of the file.

Example

/* Main program */ 
status = stream(Example.txt)
say status

When we run the above program, we will get the following result.

Output

READY 
rexx_functions_for_files.htm
Advertisements