Synchronized Scrolling The SYNC Command

The synchronized scrolling feature, available from the RI/Edit screen, provides a convenient way to update matching data in referential sets. When a parent table and one or more child tables are displayed together, the child rows that have foreign keys matching the current row in the parent table can automatically be displayed. Scrolling from row to row in the parent table, the child table's rows are automatically scrolled so that the matching data appears. To change to synchronized scrolling (SYNC) mode, enter the primary command SYNC on the RI/Edit screen as shown in the following example, then press Enter.
carcudb2
The synchronized scrolling feature, available from the RI/Edit screen, provides a convenient way to update matching data in referential sets. When a parent table and one or more child tables are displayed together, the child rows that have foreign keys matching the current row in the parent table can automatically be displayed. Scrolling from row to row in the parent table, the child table's rows are automatically scrolled so that the matching data appears. To change to synchronized scrolling (SYNC) mode, enter the primary command SYNC on the RI/Edit screen as shown in the following example, then press Enter.
When the SYNC command is issued, the message SYNCHRONIZED SCROLLING AND RI/CHECKING HAVE BEEN ACTIVATED appears. The screen displays only one row for each parent table, and each child table displays the dependent rows of its parent table row.
RI/Checking has been activated means that the CHECK ON command has been issued, and users will be prevented from making table updates that violate referential integrity.
The CHECK ON feature only checks data that is retrieved by RI/Edit.
If users try to enter rows based on what is on screen, but data queries had been used to limit data retrieval, then actual changes may in fact
not
be made when DB2 tries to make the update.
To remove this constraint, enter CHECK OFF and press Enter. Keep in mind that CHECK OFF does not allow users to bypass restraints imposed by DB2. When RI/Edit tries to make a change that is not allowed by DB2, DB2 will catch the violation.
In the following example, the data in FORNKEY1 and FORNKEY2 of the two child tables matches KEY1 and KEY2 in the parent table. KEY1 is AAAAAA, and KEY2 is AAA.
 RUEDITH        ----------------- CA RI/Edit ------------------   COMMAND ===>                                                  SCROLL ===> PAGE   RU548I: Synchronized scrolling and RI/Checking has been activated.                Table   ==> 1.USER5.RI_PARENT                 Row number ==> 1 OF 20             Current ==> 1.USER5.RI_PARENT                 Max Char   ==> 070 Active ==> 1    SSID: D81B ---------------------------------------------------------- USER3      OPT S KEY1   KEY2 NONKEY1    NONKEY2                                             ___   AAAAAA AAA  FIRST      FIRST                                               -------------------------------------------------------------------------------  2.USER5.RI_CHILD  <==  1   N  USER5RI                         1 OF 1             OPT S N:DATA1                N:DATA2                N:FORNKEY1 N:FORNKEY2        ___   N FIRST                N FIRST                N AAAAAA   N AAA             ******************************* BOTTOM OF DATA ********************************                                                                                   -------------------------------------------------------------------------------  3.USER5.RI_CHILD3  <==  1   N  FORNKEY1                       1 OF 1             OPT S N:DATA1                N:DATA2                N:FORNKEY1 FORNKEY2          ___   N 1                    Y -------------------  N AAAAAA   AAA               ******************************* BOTTOM OF DATA ********************************   
The next example shows the result of scrolling with F8 (Down). The parent table displays the next row, and the child tables show no matches for the AAAAAA and BBB data in the KEY1 and KEY2 columns.
 RUEDITH        ----------------- CA RI/Edit ------------------   COMMAND ===>                                                  SCROLL ===> PAGE                                                                                    Table   ==> 1.USER5.RI_PARENT                 Row number ==> 2 OF 20             Current ==> 1.USER5.RI_PARENT                 Max Char   ==> 070 Active ==> 1    SSID: D81B ---------------------------------------------------------- USER3      OPT S KEY1   KEY2 NONKEY1    NONKEY2                                             ___   AAAAAA BBB  SIXTH      SIXTH                                               -------------------------------------------------------------------------------  2.USER5.RI_CHILD  <==  1   N  USER5RI                         0 OF 0             OPT S N:DATA1                N:DATA2                N:FORNKEY1 N:FORNKEY2        ******************************* BOTTOM OF DATA ********************************                                                                                    -------------------------------------------------------------------------------  3.USER5.RI_CHILD3  <==  1   N  FORNKEY1                       0 OF 0             OPT S N:DATA1                N:DATA2                N:FORNKEY1 FORNKEY2          ******************************* BOTTOM OF DATA ********************************
The next example shows the result of scrolling with F8 (Down) again. The parent table displays the next row. The first child table shows three matches for the AAAAAA and CCC data in the parent table's KEY1 and KEY2 columns, and the second child table shows one matched row.
 RUEDITH         ----------------- CA RI/Edit -----------------   COMMAND ===>                                                  SCROLL ===> PAGE                                                                                    Table   ==> 1.USER5.RI_PARENT                 Row number ==> 3 OF 20             Current ==> 1.USER5.RI_PARENT                 Max Char   ==> 070 Active ==> 1    SSID: D81B ---------------------------------------------------------- USER3      OPT S KEY1   KEY2 NONKEY1    NONKEY2                                             ___   AAAAAA CCC  FIRST      THIRD                                               -------------------------------------------------------------------------------  2.USER5.RI_CHILD  <==  1   N  USER5RI                         1 OF 3             OPT S N:DATA1                N:DATA2                N:FORNKEY1 N:FORNKEY2        ___   N FIRST                N UPDATE               N AAAAAA   N CCC             ___   N FIRST                N UPDATE               N AAAAAA   N CCC             ___   N FIRST                N UPDATE               N AAAAAA   N CCC             ******************************* BOTTOM OF DATA ********************************                                                                                   -------------------------------------------------------------------------------  3.USER5.RI_CHILD3  <==  1   N  FORNKEY1                       1 OF 1             OPT S N:DATA1                N:DATA2                N:FORNKEY1 FORNKEY2          ___   N 2                    Y -------------------  N AAAAAA   CCC               ******************************* BOTTOM OF DATA ********************************
By seeing the matches on the same screen, you can edit each table as needed. To find foreign keys that
do not
have a match in the parent table, you can use the E command described in the next section. To turn off the synchronized scrolling mode and return to the regular display for the RI/Edit screen, enter SYNC OFF and press Enter.