Read Dataset – Source Reference
The Read Dataset <RemoteFile> element is used for reading the content of a remote file or host data set and is often used for data verification
Syntax
The syntax of the Read Data set element is
where the path attribute is an absolute path to a USS file or the name of a data set. The ashex attribute declares if the content should be retrieved as plain characters or as hex values. The ID attribute defines the ID used for referencing the data.
After executing the element its content will always be one simple dataitem with a value equal to the content of the dataset/file. It can be referenced later in the test scenario by using the Data Reference element or directly in JavaScript by using the ID as a variable. A Read Dataset element can be used to extract content of a data set after executing a component. This can be followed by a Verify element where expressions can be used to verify if the content is as expected.
An example of retrieving a data set (a COBOL copybook) is illustrated below. The JavaScript in the Actual part of the Verify element iterates over all lines and it returns true if one of the lines contains the characters ‘Xadb2tst-import.’. The example also shows the usage of println() in the test scenario. This method will print statements to the execution log.
<Verify name="Verify with Expression" haltExecution="false">
<Expected expression="true" />
<Actual>
<data:Replaceable>
<Expression>
<Statement><![CDATA[var lines = anId.split('\n');
function containsText(line){
println('line:'+line);
return line.indexOf('Xadb2tst-import.')!=-1;
}
lines.some(function(line){
return containsText(line);
});]]></Statement>
</Expression>
</data:Replaceable>
</Actual>
</Verify>