CREATE_DATA_JOURNAL_READER scalar function
The CREATE_DATA_JOURNAL_READER scalar function creates a table function that can be used to access entry specific data from a data journal for a specific file.
The column definitions for the file file-name in library-name are used to generate a table function that can read data from a data journal for entries with journal code R (Record operation).
Columns that have data types CLOB, DBCLOB, BLOB, XML, DATALINK, and user defined types are not returned in the viewable data.
The function name is constructed as follows: DISPLAY_JOURNAL_library-name_file-name. It is created in output-library.
If a function by that name already exists, it is replaced.
- *ADD and *EXECUTE authority to output-library, and
- All the authorities required by CREATE FUNCTION (SQL table)
- If the function exists, all the authorities required for OR REPLACE for CREATE FUNCTION (SQL table)
- library-name
- A character string containing the name of the library that contains file-name.
- file-name
- A character string containing the name of the file. This must be the system object name. The file must be journaled.
- output-library
- A character string containing the name of the library where the table function to access the journal data is to be located. The library must exist.
The result of the function is an integer. If the table function is created successfully, the value 1 is returned. If the create is not successful, the value -1 is returned.
The table function is created with *PUBLIC *EXCLUDE authority. It is owned by the caller of this function.
Example
- Create a table function that can be used to view data in the PRODLIB/ORDERS
table.
VALUES QSYS2.CREATE_DATA_JOURNAL_READER(LIBRARY_NAME => 'PRODLIB', FILE_NAME => 'ORDERS', OUTPUT_LIBRARY => 'MYLIB');

