How to retrieve catalog information about a table |
There are several tables and views exists in QSYS2 scheme that fulfil several purposes of the end user. The SYSTABLES view is one of them that contains a row for each table and view in the schema. It does not contain information about tables present in the QTEMP library.
This view provides information such as object type (Table/view), object name, owner of the object and schema where the object exists.
SELECT SYS_TNAME, SYS_DNAME, FILETYPE, "TYPE", CREATOR FROM qsys2.systables WHERE SYS_TNAME ='PF1' and SYS_DNAME ='EASYCLASS1'
SYSTEM_TABLE_NAME SYS_DNAME FILETYPE TYPE CREATOR PF1 EASYCLASS1 D T EASYCLASS
Type is 'T' means its a table and FILETYPE is 'D' means its a data file.
SELECT SYS_TNAME, SYS_DNAME, FILETYPE, "TYPE", CREATOR FROM qsys2.systables WHERE SYS_TNAME ='QDDSSRC' and SYS_DNAME ='EASYCLASS1'
SYSTEM_TABLE_NAME SYS_DNAME FILETYPE TYPE CREATOR QDDSSRC EASYCLASS1 S P EASYCLASS
Here Type is 'P' means a physical file and FILETYPE is 'S' means a source physical file.
SELECT SYS_TNAME, SYS_DNAME, FILETYPE, "TYPE", CREATOR FROM qsys2.systables WHERE SYS_TNAME = 'SYSFUNCS' and SYS_DNAME ='QSYS2'
SYSTEM_TABLE_NAME SYS_DNAME FILETYPE TYPE CREATOR SYSFUNCS QSYS2 D V QSYS
Here Type is 'V' means a View and FILETYPE is 'D' means a data file.