Accessing related table edit


To access Related Table Edit, you must first access the Edit function by selecting option 2 from the Primary Option Menu. To edit a related table, you must specify a relationship file at the bottom of the Edit Options screen (see the following figure).

Important

The Edit Options screen and the Browse Options screen are the same except for the following differences: Different screen titles, the Lock Table and Audit Trail options do not appear on the Browse Options screen, and you cannot enter 0 for insert in the Maximum Rows to Select field on the Browse Options screen.

Edit Options screen

image2021-3-10_14-9-46.png

The REDIT primary command initiates a Related Table Edit session (REDIT Primary Command). The RBROWSE primary command initiates a Related Table Browse session. They can be issued from either a Browse or Edit session.

Open Related Parent

If only one table is currently open you can either open a parent or a dependent of the current table with the REDIT and RBROWSE commands. After you open the parent table from a dependent table editing behavior is the same as multiple unrelated table editing (see Editing-Multiple-Unrelated-Tables). However, you cannot open any additional tables until the parent table has been closed.

Open Related Dependent

After you open a dependent table you can open any descendant table (dependent of a dependent table) with the REDIT/RBROWSE commands. Issue REDIT or RBROWSE in the last opened window (window 5 of 5, for example).

Open Another Related Dependent Path

Issue REDIT or RBROWSE in any but the last window display (for example 2 of 5) to open another dependent path of the first opened (original parent) table. Use the PATH command to switch between paths (see also PATH).

The commands are cursor sensitive. To select a specific row, place the cursor on the desired line before pressing Enter. If a row is not selected or the REDIT or RBROWSE command is selected from the Open pull-down, the top row is the default selected row.

All primary commands that are valid in Edit are also valid in Related Table Edit. All primary commands valid in Browse are also valid in Related Table Browse.

REDIT Primary Command

image2021-3-10_14-11-1.png

Related Table Edit sessions are between parent and dependent tables.

Parent to Dependent

When you initiate a parent and dependent session, File-AID for Db2 shows those rows in the dependent table that is related to the selected row in the parent table (see the following figure).

Related table windows appear after the selected row from the parent table. Only one row from the parent table displays; it is protected. The last dependent table opened covers the remaining window display.

Related Table Edit Session - Dependent Table

image2021-3-10_14-12-6.png

Dependent to Parent

When you initiate a dependent to parent session, File-AID for Db2 displays the row in the parent table that is the parent to the selected row in the dependent table (see the following figure).

Remember: Editing behavior is the same as for multiple unrelated table editing, so, for example, synchronized scrolling is not active.

Related Table Edit Session - Parent Table

image2021-3-10_14-12-53.png

Editing Requirements - Related Dependent Tables

You can only edit the related rows of a dependent table. For example, the second window in Related Table Edit Session - Dependent Table shows only those rows in the employee table that are related to the selected row in the department table; that is, employees that work in department A00. To edit any other rows in the employee table, you must scroll the parent table to select another row. See Scrolling Windows for more information.

You can only edit one table at a time. The table that can be edited is the active table in the active window. Active windows are highlighted. Non-active windows are protected and not highlighted. You can move between tables using the JUMP primary command, but you cannot move the cursor manually to another table. See Navigating Through Multiple Windows for more information on using the JUMP command. You can move between paths using the PATH primary command. See Switching To Other Paths and PATH for more information on using the PATH command.

Window Display

An unlimited number of tables within up to 16 paths may be opened during an edit session by repeatedly issuing the REDIT command. A maximum of three windows can appear at one time. When the screen is full and you open another table, the table at the top of the display rolls off of the display. Each table moves up to make room for the next table.

The following figure shows a sample Related Table Edit session with five open tables; three of them are shown.

Important

After opening the related parent table with REDIT, no other windows can be opened until the parent table has been closed.

Related Table Edit Session with Dependent Tables

image2021-3-10_14-13-47.png

The window title bar displays the following information:

  • Product name.
  • Product mode: REDIT or RBROWSE.
  • Type of relationship: AR (Application Relationship) or RI (Referential Integrity).
  • Fully qualified table name: Location.creator.table.
  • Path number and total number of opened paths. Displays only when more than one path is open and only in the first window of each path. For example: PATH 2 OF 6, the 2 indicates that it is the second path opened and the 6 indicates that six paths are currently open.
  • Window number and total number of windows open, within the current path. For example: If a window displays 2 OF 6, the 2 indicates that it is the second window opened and the 6 indicates that six windows are open in the current path.
  • Db2 subsystem identification.

Only column headings display in Related table windows. The second and third heading lines (column type, column length, key descriptions, and underscores) shown in standard Edit no longer appear.

When viewing an active window:

  • Primary and foreign keys appear first and are protected.
  • Column headings for non-keyed columns are blue.
  • Column headings for primary keys are highlighted.
  • Column headings for foreign keys are yellow.

Table Requirements

The initial table from which you initiate a Related Table Edit session is referred to as the driving table. The driving table must be a table, view, local alias or synonym. It cannot be a remote alias.

Dependent tables can be a table or view. You cannot edit related synonyms, or aliases.

Use of Views

File-AID for Db2 supports views of tables in the Related Edit/Browse function. If you specify a view as the driving table, File-AID for Db2 lists relationships defined for the view, not the underlying base table. As in previous releases, you can also change dependent table names to view names on the Related Table List enabling you to edit/browse dependent views instead of the listed tables.

Important

In releases prior to Release 3.9, when you specified a view as the driving table, File-AID for Db2 used the relationships defined for the view’s base table as File-AID for Db2 did not support defining relationships for views. Starting with Release 3.9 you receive the message “No relationships exist for table: Viewname" unless you already defined an AR relationship for the view. Now define application relationships (see Application Relationships (AR)) for the View based on the direct dependencies of the view’s base table. For example, in releases prior to 3.9 the driving table/view DSN8410.VDEPT used the relationships defined for base table DSN8410.DEPT. To achieve similar related edit/browse results in Release 3.9 and later, you just need to define AR relationships (Option 6.3) from view VDEPT to the direct dependents of the view’s base table DEPT.

Base table DSN8410.DEPT has these relationships:

Base Table Relationship

Parent


Dependent

Table

Column


Table

Column

DEPT

DEPTNO

==>

EMP

WORKDEPT

DEPT

DEPTNO

==>

DEPT

ADMRDEPT

DEPT

DEPTNO

==>

PROJ

DEPTNO

EMP

EMPNO

==>

DEPT

MGRNO

Now define these relationships for the view VDEPT:

View Relationship

Parent


Dependent

Table

Column


Table

Column

VDEPT

DEPTNO

==>

EMP

WORKDEPT

VDEPT

DEPTNO

==>

VDEPT

ADMRDEPT

VDEPT

DEPTNO

==>

PROJ

DEPTNO

EMP

EMPNO

==>

VDEPT

MGRNO

Then, when you enter VDEPT as the driving table for related edit/browse, File-AID for Db2 will list all relations for view VDEPT and other associated relationships treating the view as a separate object from the base table.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*