I have created a source member (text file) in one of my source files in my library on the IBM i development machine where I have written several SQL queries separated by a semicolon(;). Instead of using STRSQL
on the IBM i green screen, I want to use the RUNSQLSTM
. What should be the exact parameters and values that I need to specify when using the RUNSQLSTM
command to execute all of my SQL queries in the text file (source member)?
Please also tell us the way to use the RUNSQLSTM
command when the text file with SQL queries is placed on the IFS path
instead of library/sourcefile(source member)
.
You can use the
RUNSQLSTM
command instead of theSTRSQL
command over a text file stored in IFS and a source member present in the source file in a library. Please note that the queries that are not returning any result set should be placed inside the text files/source file members.If the SQL queries are written inside the source member present in the source physical file in a library, then use the
RUNSQLSTM
command as follows to execute the SQL queries at once.RUNSQLSTM SRCFILE(libname/srcpfName)
SRCMBR(srcmbrName)
COMMIT(*NONE)
DFTRDBCOL(libname)
DBGVIEW(*SOURCE)
If the SQL queries are present in the text file on the IFS path, then use the
RUNSQLSTM
command as follows to execute the SQL queries at once from the text file on the IFS.RUNSQLSTM SRCSTMF(/home/admin/query_file.sql)
COMMIT(*NONE)