Read Command

Description:

This command reads a single record from an external file that is currently opened (with the FOR INPUT option) into a variable.
The record read will be delimited by a newline character in the file. This newline character is used purely as a record delimiter and does not form part of the record.
By default, the file will be rewound when the end of file is reached. This action may be modified by use of the "AT END GOTO label" clause.
The file is read sequentially.

Format:

READ stringVariable FROM fileId;
READ stringVariable FROM fileId AT END GOTO labelName;

Parameters:

stringVariable

A string variable in which the next record from the file is read.

fileId

A FILE variable that was used in a previous OPEN command.

labelName

A label within the current scope of the Script, to which Script execution will branch if the end of file is reached.

Example:

FILE DataFile;
STRING szUser;

OPEN "UserNames" AS DataFile;
While ( 1 )
    READ szUser FROM DataFile AT END GOTO exitLabel;
EndWhile

exitLabel:
CLOSE DataFile;





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap