Listing related tables
When you are in a File Manager/Db2 View or Edit editor session, you can issue the REDIT primary command to display a list of tables related by a Db2® referential integrity (RI) constraint to the Db2® object currently being edited.
When you enter the REDIT primary command, you can optionally supply a field number that identifies the column in the table of the Db2® object currently being edited.
The way in which FM/Db2 responds after you enter the REDIT primary command depends on the object you are editing, the position of the cursor, and whether you specify a column number:
- When the object being edited does not have RI constraints, a new FM/Db2 Edit session is stacked on top of the existing Edit session. You are presented with the Db2® Edit entry panel.
- When the object being edited does have RI constraints:
- When the cursor is not located in the data portion of the screen, or is not located on the data for a column of the table, FM/Db2 displays a selection list showing all the Db2® objects that are directly related to the object being edited by an RI constraint. This includes tables that are parent tables in a relationship with the table being edited, and tables that are dependent tables in a relationship with the table being edited.
- When the cursor is located on the data for a column of the table, and that column is not part of a primary, parent or foreign key, FM/Db2 displays a selection list showing all the Db2® objects that are directly related to the object being edited by an RI constraint. This includes tables that are parent tables in a relationship with the table being edited, and tables that are dependent tables in a relationship with the table being edited.
- When the cursor is located on the data for a column of the table, and that column is part of a primary, parent, or foreign key, FM/Db2 displays a selection list showing only those Db2® objects that are directly related to the object being edited, limited to those tables where the primary, parent, or foreign key of the table being edited contains the column where the cursor is located.
- When you have specified a field number with the REDIT primary command and the column identified by the field number is part of a primary, parent, or foreign key, FM/Db2 displays a selection list showing only those Db2® objects that are directly related to the object being edited, limited to those tables where the primary, parent, or foreign key of the table being edited contains the column identified by the field number.
- When a field number is provided with the REDIT command and the column identified by the field number is not part of a primary, parent, or foreign key, FM/Db2 displays a selection list showing all the Db2® objects that are directly related to the object being edited by an RI constraint. This includes tables that are parent tables in a relationship with the table being edited, and tables that are dependent tables in a relationship with the table being edited.
The list of related tables for an object is displayed by the FM/Db2 Object List utility on the Related tables panel. You can issue a number of prefix commands against any of the objects shown on the list. For example:
- Prefix command
- FM/Db2 displays…
- EE or VE
- A new FM/Db2 editor session for the selected object. The new
FM/Db2 editor session appears in a new ISPF logical screen (as though you
had split the screen and started a new FM/Db2 session). The first panel displayed, and the rows displayed in the Edit (or View) session, depend on where you position the cursor at the time of entering the REDIT command:
- When the cursor is located on the data for a column that is part of a parent, primary, or foreign key, the new FM/Db2 editor session starts with the display of data, and contains only those rows related to the row where the cursor was located.
- When the cursor is not located on the data for a column that is part of a parent, primary, or foreign key, the new FM/Db2 editor session starts with the display of the Db2® Edit (or Db2® View) entry panel (where you can alter the object name if required), and contains all rows of the object.
- E or V
- A new FM/Db2 Edit session stacked on top of the existing Edit session.
To see all the available commands, type "?" in the selection field (SEL) to the left of any entry and press Enter.
You can only issue the REDIT command when editing a table. The REDIT command is inoperative when editing a view.
Related references