I have a dynamic sql file in which name of TBCREATOR changes as given in a parameter.
I use a simple python script to change the
TBCREATOR=<variable here> and write the result to an output sql file.
calling this file using
db2 -td@ -vf <generated sql file>gives
DSNC105I : End of file reached while reading the command
Here is the file i need the TBCREATOR variable replaced:
CONNECT to 188.8.131.52:5040/DALLASC user *** using ****@ select REMARKS from sysibm.SYSCOLUMNS WHERE TBCREATOR='table' AND NAME='LCODE' @
Here is the python script:
#!/usr/bin/python3 # #------replace table value with schema name # print(list_of_lines) fin = open("decrypt.sql", "rt") #output file to write the result to fout = open("decryptout.sql", "wt") for line in fin: fout.write(line.replace('table', 'ZXP214')) fin.close() fout.close()
After decryptout.sql is generated I call it using
db2 -td@ -vf decryptout.sql
and get the error given above.
Whats irritating is I have another sql file that contains exactly same data as decryptout.sql which runs smoothly with the
db2 -td@ -vf ... command. I tried to use the unix command
cmp to compare the generated file and the one which I wrote, with the variable
ZXP214 already replaced but there are no differences. What is causing this error?.
here is the file (that executes without error) I compare generated output with:
CONNECT to 184.108.40.206:5040/DALLASC user *** using ****@ select REMARKS from sysibm.SYSCOLUMNS WHERE TBCREATOR='ZXP214' AND NAME='LCODE' @