OPEN Command
Description:
This command opens an external data file for input access and associates an OpenSTA Dataname with it, for future reference.
When reading records from a file, data will be read up to but not including a newline character. The newline character will be skipped over to position the file at the start of the next record to be read.
The record read will be truncated as required to fill the specified variable.
Reads are independent for each thread.
A maximum of 10 external data files may be open for each thread at any one time. Attempting to open more than this number will result in a script error being reported.
The "ON ERROR GOTO err_label" clause can be specified to define a label to which control should be transferred in the event of an error. This must be the last clause in the command.
Format:
OPEN filename AS fileid {ON ERROR GOTO err_label}Parameters:
filename
A character variable or quoted character string containing the filename (excluding the path name) of the file to open. The file must reside in the data directory of the Repository.
fileid
An OpenSTA Dataname associated with the file when it is opened; it is used to identify the file in future references. The "fileid" must be declared in a FILE statement in the Definitions section of the script.
err_label
A label defined within the current scope of the script, to which control branches if an error occurs.
Examples:
OPEN "Usernames" AS datafile ON ERROR GOTO file-error OPEN myfile AS datafile ON ERROR GOTO file-error
OpenSTA.org Mailing Lists Further enquiries Documentation feedback CYRANO.com |