$status=`perl /usr/local/hp/nvscript/bin/hpnvs.pl "$reorgtable"`; print "Reorg status :".$status;
print "\n";
$status=`perl /usr/local/hp/nvscript/bin/hpnvs.pl "$updatestats"`; print "Update statistics status :".$status;
print "\n";
# | |
@resultrows=`perl /usr/local/hp/nvscript/bin/hpnvs.pl "$selecttable"`; | |
# | |
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/nvscript/bin/hpnvs.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 (hpnvs.pl or hpnvs.py) in the program file:
•On Windows:
•On Linux or UNIX:
Launching Neoview Script From a Perl or Python Program 77