RC/Edit Processing Flow Components
The following diagram depicts a possible processing flow:
RC/Edit Processing Flow
The following diagram depicts a possible processing flow:
Screen Flow for RC/Edit
RC/Edit is composed of the following screens.
- Table Selection – Displayed when SQL selection criteria are input for the Item and Creator prompts. All tables matching the selection criteria and associated authorizations are displayed.
- Edit Options – Controls data to be edited in a table. Displayed for the E option. Can also be used with the fast edit (FE) option.
- Statistics Summary – Displays editing statistics during an edit session when the STATS command is entered. Pending statistics (the number of updates, deletes, and inserts that will be done if the user saves the data) are included on this screen.
- Data Query List, Data Query Edit – The Data Query List screen permits users to select a previously saved SQL statement for execution, edit, or deletion. The Data Query Edit screen is used to create or edit an existing SQL statement. All column names are listed and any WHERE clause can be input. Replaceable parameters are also supported.
- Edit Screens – Column Mode and Form Mode displays. The Column Mode displays the data in tabular form (columns appear horizontally across the top of the screen) and the Form Mode displays one row per screen (columns appear vertically down the left side of the screen).
- Explode Mode – Permits character columns to be edited using the ISPF full screen editor. Placing the cursor on a character column and pressing the EXPLODE PF key will explode the column's data into a full screen edit session, allowing easy editing of LONG VARCHAR data and data copying into character columns from other sources.
Locking Considerations - Positional Update Method
Locking is not a concern in browse mode.
The Positional Update method updates only one row. The row that is updated is determined by the current position of a cursor. The rows are refetched in their original order to get to the row that needs to be updated, as in the following statements.
UPDATE DSN8320.EMP SET WORKDEPT = :HOST1 WHERE CURRENT OF CURSOR1 HOST1 = 'B01' CURSOR1 is defined as follows: DECLARE CURSOR1 CURSOR FOR SELECT EMPNO, WORKDEPT FOR UPDATE OF WORKDEPT
Locking Considerations - Searched Update Method
Locking is not a concern in browse mode.
When editing a table using the Searched Update method, it cannot be locked. The table name is enqueued in its own internal queue. No DB2 locks are placed on the table, but RC/Edit will not permit another user to edit the table using the Positional Update method.
Multiple users can edit the same table as long as they all use the Searched Update method. If another user attempts to edit the table using the Positional Update Method, a message appears to both users informing them of the contention. (In a data sharing environment where the other user is on a different z/OS system, you will see the message, but the other user will not.)
Data Type Verification
When editing data, RC/Edit performs type verification and full range checking based on the column's DB2 data type. Specific data verification rules follow:
- General Numeric Rules – All numeric values must be within the defined numeric range. For example, a SMALLINT of 99,999 cannot be entered. Type over any existing commas or decimal points. They will automatically be reinserted. Commas are optional.
- Character Data – The following points apply to character data.
- Maximum Length. Data cannot be entered that exceeds the field's maximum length.
- CHANGE. If data exceeds the field's maximum during a CHANGE, processing stops at the field that would cause the truncation error.
- CHANGE ALL. The fields that could be changed (no truncation errors) are highlighted.
- EXPLODE. The data is truncated upon return from the ISPF session.
- VARCHAR. Two options are available for processing trailing blanks when editing VARCHAR and LONG VARCHAR columns with an EDIT screen.First, when updating columns with RC/Edit, any trailing blank spaces are automatically deleted for selected VARCHAR columns to save storage space. The trailing spaces are deleted if any columns in the row are updated, regardless of whether the VARCHAR column is updated. For rows with no column updates, the VARCHAR columns are not changed.Second, you can preserve trailing blanks using delimiter characters set by the user on the RC/Edit Parameters screen. The default opening and closing delimiter characters are the less than (<) and greater than (>) characters, respectively.Data strings can contain embedded delimiter characters. To begin and end a data string with delimiter characters (for example, '<abc >'), insert the opening and closing delimiters as usual (for example, '<<abc >>').When fetching rows, RC/Edit automatically inserts the delimiter characters if a column's data contains leading and/or trailing blanks, or if the first and/or last data character is one of the delimiter characters. However, when entering data through RC/Edit, you must enter the delimiter characters yourself to preserve trailing blanks and data that begins and ends with delimiter characters.
- CAPS ON/OFF. Use the CAPS ON/OFF command to control the case. Whole columns can be converted to upper or lower case by entering the LCASE or UCASE commands.The display length of character fields does not affect the FIND, RFIND, CHANGE, RCHANGE, and CHANGE ALL command. The complete column's length is searched regardless of the display length. To view the whole column, use the EXPLODE command.
- BIGINT – Value must be from - 9223372036854775808 to 9223372036854775807.
- SMALLINT – Value must be from -32,768 to 32,767.
- INTEGER – Value must be from -2,147,483,648 to 2,147,483,647.
- DECIMAL – The number of digits are automatically truncated to the right of the decimal point based on the column's definition. Value must be from +/- 9,999,999,999,999,999,999,999,999,999,999.
- FLOAT, REAL, DOUBLE PRECISION – Data must follow exponential notation. If the number is entered without exponential notation, it will automatically be converted. Type over the decimal point during entry and it will automatically be renormalized with the corresponding change made to the exponent. Value must be approximately from +/- 7.2E+75 to +/- 5.4E-79.
- DATE – The entry must follow standard date rules. The cursor will be positioned on the invalid entry within the date field, such as an invalid month. The date format is DB2 installation dependent. Value must be from 0001-01-01 to 9999-12-31.
- TIME – Entry must follow standard time format. The cursor will be positioned on the invalid field. The time format is DB2 installation dependent. Value must be from 00.00.00 to 24.00.00
- TIMESTAMP – Same rules as above for DATE and TIME. Value must be within above ranges.
When you insert a row, all fields are given an initial value based on the field type.
- Character Data (CHAR and VCHAR) – Spaces.
- Numeric (all types) – Zeros.
- Date – Current date.
- Time – Current time.
- Timestamp – Current date and time.
- Identity column – If the column is generated always, a value is always supplied by DB2. If the column is generated by default, you can specify a value that RC/Edit uses to override the DB2 generated value.
This section describes the guidelines for you to follow when entering data:
- To enter a new value for a field, enter the number and press EOF to clear the remaining data.
- To zero out a field, press EOF and press Enter. A zero value will automatically be inserted.
- To make a value negative, enter a minus sign anywhere within the blank part of the field.
- To update a number, cursor over and type over the existing values. Type over commas. RC/Edit automatically reinserts commas and decimal points when Enter is pressed.
- Insert character data by using the insert key. All fields have implied NULLs at the end.
- In Column Mode, all numbers are right justified. The cursor is positioned at the left. To append digits to the front of a number, enter the digits and press Enter. The digits automatically move to the front of the number.
- In Form Mode, all values are left justified, so all data is aligned. Press the INS key to add digits to the front of a number.
- To enter data values that are longer than the display area, specify the EXPAND primary command, place your cursor in the area to be expanded, and press Enter.
If a field is defined as NULL, then the RC/Edit Null Indicator (see Column Mode Edit or Form Mode Edit) will be Y for these fields. Default values are placed into NULL fields to provide templates and default values. Remember, if the Null Indicator is Y, the field is considered null. To enter a not null value, the NULL indicator must be set to N. For fields defined as NOT NULL or NULL WITH DEFAULT, the above default values will always be applied.
If specific table columns are selected for editing, the remaining, non-selected columns can be defined with the NOT NULL attribute. In this case, inserts or replicates cannot be performed during the edit session. This restriction is applied because any rows inserted to DB2 would fail on a NULL error.
If an identity column is GENERATED BY DEFAULT, a G indicator appears before the column. The column will have a value of Y or N for an inserted row:
- Y – The field will contain dashes. When the row is inserted into the database, DB2 will assign a value to the field.
- N – The field will contain a valid integer value. When the row is inserted into the database, DB2 will not assign a value; it will use the value specified by the user.
If the row was fetched from the database, the column will have a value of N for the G indicator. If you change N to Y, the change is ignored and the value is set back to N. (The G indicator will only show Y if the row has not yet been inserted into the database; DB2 generates a value for the field when the row is inserted into the database.)
An inserted row shows I in the Opt field at the left of the line and a fetched row shows some other value other than I in this field.
HEX Mode Support
RC/Edit and RC/Browse accept and process columns with hexadecimal data. If the retrieved data contains nondisplayable (hex) characters, the hex characters are displayed as periods and the following message appears:
HIGHLIGHTED CHAR TYPE COLUMNS CONTAIN INVALID (NONDISPLAY) CHARACTERS
To edit or browse the hex characters, use the RC/Edit or RC/Browse column mode screens or the RC/Edit or RC/Browse Explode Facility screen. If there are nondisplayable characters, ISPF Edit or Browse is invoked. Toggle the ISPF command off and on by entering HEX in the command line.
Updating the Actual Data
While in the edit session, no changes are actually made to DB2 until the data is saved. Changes are committed to DB2 by using primary edit commands. These commands can be entered on the command line or assigned to function keys.
To display an explicit confirmation dialog before any changes are committed, specify COMCONF=Y in the RCEDIT parmlib member. When COMCONF=Y, the RC/Edit Commit Confirmation panel appears before any changes are committed during or before leaving an edit session.
Update Order - Positional Method
When RC/Edit applies updates using the Positional Update method, they are applied in fetch order, NOT in the current display order. The order of updates is inconsequential except for the case of unique indexes on columns. For example, a user can delete a row that has a primary key value of 5, and then update another row, assigning the same primary key of 5. If the delete does not occur before the update, a duplicate error will occur.
As a result, there may be need to make some updates involving unique indexes by using multiple edit sessions or issuing the SAVE command to commit the index changes during the edit session.
Update Order - Searched Method
The Searched Update method updates the rows in the order they are displayed on the screen. The Searched method uses only half as many fetches as the Positional method.
The Table Selection facility permits table selection from a list. You can control the list of tables displayed by entering selection criteria for the Item Name or Creator prompts that appear in the header. An extended query can also be entered to further refine the list of displayed tables. (If a specific table name is entered, this screen is not displayed.)
Embedded blanks are supported in table and creator names. When specifying a value for Item Name or Creator, you can also embed blanks at the beginning or elsewhere in the value.
When columns are updated, the processing updates
allcolumns in the DB2 tables rows. This can cause DB2 triggers that should only be executed if specific columns are updated to execute anyway. To prevent this from occurring, add the following to the CREATE TRIGGER DDL:
- The SQL clause REFERENCING OLD AS OROW
- A WHERE condition that checks if the trigger action column actually changed
Double-Byte Character Data
The EXPLODE command might need to be used (along with a graphics display terminal) to browse DBCS (Double-Byte Character Set) data or graphics data.