Edit procedures

An edit procedure is assigned to a table by the EDITPROC clause of the CREATE TABLE statement. An edit procedure receives the entire row of a base table in internal DB2® format. It can transform the row when it is stored by an INSERT or UPDATE SQL statement or by the LOAD utility.

Begin program-specific programming interface information.
An edit procedure can be defined as WITH ROW ATTRIBUTES or WITHOUT ROW ATTRIBUTES in a CREATE TABLE statement. An edit procedure that is defined as WITH ROW ATTRIBUTES uses information about the description of the rows in the associated table. You cannot define an edit routine as WITH ROW ATTRIBUTES on a table that has the following characteristics:

  • The table contains a LOB, ROWID, or XML column.
  • The table contains an identity column.
  • The table contains a security label column.
  • The table contains a column name that is longer than 18 EBCDIC bytes.

You cannot define an edit procedure as WITHOUT ROW ATTRIBUTES on a table that has LOB columns.

The transformation your edit procedure performs on a row (possibly encryption or compression) is called edit-encoding. The same routine is used to undo the transformation when rows are retrieved; that operation is called edit-decoding.

The edit-decoding function must be the exact inverse of the edit-encoding function. For example, if a routine encodes 'ALABAMA' to '01', it must decode '01' to 'ALABAMA'. A violation of this rule can lead to an abend of the DB2 connecting thread, or other undesirable effects.

Your edit procedure can encode the entire row of the table, including any index keys. However, index keys are extracted from the row before the encoding is done, therefore, index keys are stored in the index in edit-decoded form. Hence, for a table with an edit procedure, index keys in the table are edit-coded; index keys in the index are not edit-coded.

The sample application contains a sample edit procedure, DSN8EAE1. To print it, use ISPF facilities, IEBPTPCH, or a program of your own. Or, assemble it and use the assembly listing.

There is also a sample routine that does Huffman data compression, DSN8HUFF in library prefix.SDSNSAMP. That routine not only exemplifies the use of the exit parameters, it also has potentially some use for data compression. If you intend to use the routine in any production application, please pay particular attention to the warnings and restrictions given as comments in the code. You might prefer to let DB2 compress your data.

End program-specific programming interface information.