You can use SQL to extract metadata directly from the database tables that make up the information catalog; this section provides examples.
SELECT OBJTYPID, DPNAME, NAME, CREATOR, PTNAME FROM FLG.OBJTYREG
This statement returns the following information:
SELECT PHYPRPNM, PROPNAME, DATATYPE, LENGTH, OPTIONS, UUISEQNO, PROPSEQ FROM FLG.PROPERTY WHERE OBJTYPID = 'object_type_ID' ORDER BY PROPSEQ
This statement returns the following information (in the order that the properties were created):
SELECT OBJTYPID, INSTIDNT, NAME,phyprpnm1,phyprpnm2... FROM creator.ptname WHERE phyprpnm LIKE '%search_criteria%'
This statement returns the following information:
In addition, you must enter the following SELECT statement to retrieve any property values that are of the data type long variable character (LONG VARCHAR):
SELECT PHYPRPNM, ODESC FROM FLG.OVERDESC WHERE OBJTYPID = object_type_ID AND INSTIDNT = object_instance_ID ORDER BY SEQNO
Where object_type_ID and object_instance_ID are the values that you obtained after you generated the SELECT statement in step 3. This statement returns the following information:
SELECT FLGID, INSTNAME, TYPENAME FROM FLG.NAMEINST
This statement returns the following information:
SELECT SOURCE, TARGET, RELTYPE FROM FLG.RELINST
This statement returns the following information:
To determine linked or attachment relationships between objects, enter the following SQL statement:
SELECT SOURCE, TARGET, RELTYPE FROM FLG.ATCHREL
This statement returns the following information:
You can use the SOURCE and TARGET values to look up the object instance information in the object tables. You can also qualify an SQL statement to select specific object values as shown in step 4.
Example: You have an application for which you want to display the metadata about a relational table named Employee, and show all of its columns. The object type for Employee is TABLES, and the object type for the columns is COLUMN. Your application includes the following SQL statements:
SELECT OBJTYPID, DPNAME, NAME, CREATOR, PTNAME FROM FLG.OBJTYREG WHERE DPNAME = 'TABLES'
The statement returns the following information:
'000001', 'TABLES', 'Relational Tables', 'USERXYZ', 'TABLES'
SELECT OBJTYPID, DPNAME, CREATOR, PTNAME from FLG.OBJTYREG WHERE DPNAME = 'COLUMN'
The statement returns the following information:
'000007', 'COLUMN', 'Columns or fields', 'USERXYZ', 'COLUMN'
SELECT OBJTYPID, INSTIDNT, NAME, DBNAME, OWNER, TABLES FROM USERXYZ.TABLES WHERE NAME = 'Employee'
The statement returns the following information:
'000001', '0040608795', 'Employee', 'MYDBASE', 'USERABC', 'EMPL_TAB'
SELECT TARGET FROM FLG.RELINST WHERE SOURCE = '0000010040608795' AND TARGET LIKE '000007%' AND RELTYPE = 'C'
The statement returns the following two objects:
('0000079238400354') ('0000079843095410')
SELECT NAME, SHRTDESC, DATATYPE, LENGTH FROM USERXYZ.COLUMNS WHERE INSTIDNT IN ('9238400354', 9843095410')
The statement returns the following information:
('Name', 'Employee name information', 'CHAR', '80') ('Address', 'Employee address information', 'CHAR', '220')