Evaluate test data
Some examples have been provided within the OShell script shown below in the example. The first lines in the script contain OShell script statements for producing simple statistics. The second part contains embedded OSI script in order to provide more complex statistics. Detailed comments to the example you will find in OShell Script comments .
In order to run the script you need a configuration or ini-file that contains the data source definition. Many service programs require such an ini-file in order to reduce the number of necessary parameters. The ini-file required for running the example looks like:
[SYSTEM]
DICTIONARY=ode.sys
[Sample]
DICTIONARY=Sample.dev
DATABASE=Sample.dat
NET=YES
ACCESS_MODE=Write
The path for the system dictionary refers to the location where the system dictionary is stored (depends on platform). DICTIONARY and DATABASE in the [Sample] section must refer to the Sample dictionary and database location.
After creating an ini-file ( OShell.ini ) and storing the OShell script file from the example below in TestData.osh , one may call the OShell command.
After processing the command passed in the script file, the OShell remains open and the data source is still active. The data collection currently selected is Person ::Persons . You may enter now further shell commands or q[uit] in order to leave the OShell.
cd Sample
cc Company
li
fa lav cars.count
fa lav employees.count
cc /Employee
count
sfc "sex == 'male'"
relativeCount
cc '/Person::Persons'
count
osi do
VARIABLES
int child_count;
int distance = 0, dist = 0;
int min_dist = 100, max_dist = 0;
int dcount = 0;
PROCESS
filter('age > 65 && employee.count == 0');
Message('Persons probably retired (over 65 and not employed): ' + relativeCount);
top();
while ( next() )
child_count += children.count;
Message('Total number of children: ' + child_count);
filter("");
top();
while ( next() )
while ( children.next() ) {
dist = age-children.age;
if ( min_dist >= dist ) min_dist = dist;
if ( max_dist <= dist ) max_dist = dist;
distance += age-children.age;
++dcount;
}
Message('Average age distance between children and parents: ' + distance/dcount);
Message(' Minimum/maximum distance is: ' + (string)min_dist + '/' + (string)max_dist);
end
cc /Company
osi do
VARIABLES
int(10,2) sum_income;
PROCESS
top();
while ( next() ) {
sum_income = 0;
while ( employees.next() )
sum_income += employees.income;
Message('Total income for "' + name + '" is: ' + sum_income);
}
end

