Neoview Command Interface (NCI) Guide (R2.3)

#-------------Display the results--------------------------------------------
foreach $rowvalue (@resultrows)
{
print $rowvalue;
}
Example of a Python Program (example.py)
import os
import sys
import string
if __name__ == '__main__':
#Define SQL statements
reorgtable="REORG TABLE neo.persnl.employee";
updatestats="UPDATE STATISTICS FOR TABLE neo.persnl.employee "
updatestats=updatestats + "ON EVERY COLUMN";
selecttable="SELECT COUNT(*) FROM neo.persnl.employee";
#Contruct a list of SQL statements to be executed
stmnt = [reorgtable,updatestats,selecttable]
print "\n";
for stmntstr in stmnt:
cin, cout ,cerr = os.popen3('python /usr/local/hp/nci/bin/hpnci.py "'+stmntstr+'"')
while 1:
text = cout.read()
if text:
print text
else:
break
while 1:
text = cerr.read()
if text:
print text
else:
break
cin.close()
cout.close()
Running the Perl or Python Program
Before running the Perl or Python program, make sure that you included the absolute path of
the Perl or Python wrapper script (hpnci.pl or hpnci.py) in the program file:
On Windows:
hpnci-installation-directory\Neoview Command Interface\bin\hpnci.pl
or
hpnci-installation-directory\Neoview Command Interface\bin\hpnci.py
hpnci-installation-directory is the directory where you installed the NCI software
files. For more information, see Table 2-1 (page 41).
On Linux or UNIX:
hpnci-installation-directory/nci/bin/hpnci.pl
or
hpnci-installation-directory/nci/bin/hpnci.py
hpnci-installation-directory is the directory where you installed the NCI software
files. For more information, see Table 2-1 (page 41).
To run a Perl program, enter the perl command at a command prompt, as this example shows:
>perl example.pl
To run a Python program, enter the python command at a command prompt, as this example
shows:
>python example.py
Launching NCI From a Perl or Python Program 87