How to: |
The STATE command sets the system variable &RETCODE to a value that indicates whether a specified file exists. The value of system variable &EXITRC also indicates whether the specified file exists.
[opsys] STATE filename
where:
Identifies the operating environment. For Windows, the value can be WINNT or DOS.
Is the file whose existence you want to determine. It can be a file name in the current path, a full path name, or an application name and filename in the form appname/filename.
After issuing the command, the variable &RETCODE has the value zero (0) if the file exists and the value -1 if the file does not exist. The variable &EXITRC has the value zero (0) if the file exists and the value 2 if the file does not exist. If the file does not exist, the following message is generated:
File doesn't exist