Work with SQL Objects for IBM i
The WRKOBJSQL command allows you to view a list of SQL-related objects for the specified library. You may do things like retrieve the SQL source code that was used to create the SQL object, view that source code, delete (drop) the object and more.
After uploading the source code to your IBM i source file members, use the following CL commands to create this utility.
Step 1: Create the Command Definition Object
CRTCMD CMD(COZTOOLS/WRKOBJSQL) PGM(COZTOOLS/WRKOBJSQL) SRCFILE(COZTOOLS/QCMDSRC) SRCMBR(WRKOBJSQL) REPLACE(*YES)
Step 2: Create the Display File used by the RPG IV program
CRTDSPF FILE(COZTOOLS/WRKOBJSQL) SRCFILE(COZTOOLS/QDDSSRC) SRCMBR(WRKOBJSQL) REPLACE(*YES)
Step 3: Lastly, compile the SQL RPG IV source member
CRTSQLRPGI OBJ(COZTOOLS/WRKOBJSQL) SRCFILE(COZTOOLS/QRPGLESRC) SRCMBR(WRKOBJSQL) OBJTYPE(*PGM) REPLACE(*YES)
After compiling the command and related objects, use the WRKOBJSQL CL command to work with SQL objects in any library.
WRKOBJSQL SQLTOOLS
In this example, the SQL Tools product library is used. You should explore the QSYS2 library as well.