Start of change

Using a data journal reader

A data journal reader table function is used to access entry specific data for a file.

A data journal reader is created using the CREATE_DATA_JOURNAL_READER scalar function. The table function it creates is named: DISPLAY_JOURNAL_library-name_file-name.

Many of the filters defined for the QSYS2.DISPLAY_JOURNAL table function are supported as optional parameters on the created table function. The function returns the individual column values extracted from the data journal for the file and additional information provided by QSYS2.DISPLAY_JOURNAL.

Authorization: The caller must have:
  • *EXECUTE and *OBJOPR authority to the *SRVPGM for the DISPLAY_JOURNAL_library-name_file-name function
  • *USE authority to the library containing the function
  • *EXECUTE authority to the library containing the database file
  • *USE authority to the database file
  • *EXECUTE authority to the library containing the data journal and journal receivers
  • *USE authority to the data journal
  • *USE authority to all requested journal receivers

Using the generated table function

The table function has the following input parameters. The table function reads the data journal information using the DISPLAY_JOURNAL table function using the values specified for these parameters. Refer to DISPLAY_JOURNAL for the parameter descriptions: DISPLAY_JOURNAL table function.
  • STARTING_RECEIVER_LIBRARY
  • STARTING_RECEIVER_NAME
  • STARTING_TIMESTAMP
  • STARTING_SEQUENCE
  • JOURNAL_ENTRY_TYPES
  • OBJECT_MEMBER, with a DEFAULT value of *FIRST
  • USER
  • JOB
  • PROGRAM
  • ENDING_RECEIVER_LIBRARY
  • ENDING_RECEIVER_NAME
  • ENDING_TIMESTAMP
  • ENDING_SEQUENCE

The table function returns a column for each column in the target table. Columns that have data types CLOB, DBCLOB, BLOB, XML, DATALINK, and user defined types are not returned by the table function.

In addition, the following columns are returned. See DISPLAY_JOURNAL for their descriptions: DISPLAY_JOURNAL table function.
  • ENTRY_TIMESTAMP
  • OPERATION - a descriptive form of JOURNAL_ENTRY_TYPE
  • USER_NAME
  • RRN
  • SEQUENCE_NUMBER
  • JOURNAL_ENTRY_TYPE
  • MEMBER_NAME
  • JOB_NAME
  • JOB_USER
  • JOB_NUMBER
  • THREAD
  • JOURNAL_IDENTIFIER
  • JOURNAL_LIBRARY
  • JOURNAL_NAME
  • RECEIVER_LIBRARY
  • RECEIVER_NAME
  • PROGRAM_LIBRARY
  • PROGRAM_NAME
  • OBJECT_TYPE
  • OBJECT_TYPE_INDICATOR
  • FILE_TYPE_INDICATOR
  • PROGRAM_LIBRARY_ASP_DEVICE
  • PROGRAM_LIBRARY_ASP_NUMBER
  • COMMIT_CYCLE
  • NESTED_COMMIT_LEVEL
  • XID
  • LUW
  • REMOTE_PORT
  • REMOTE_ADDRESS
  • SYSTEM_NAME
  • SYSTEM_SEQUENCE_NUMBER
  • REFERENTIAL_CONSTRAINT
  • TRIGGER
  • IGNORE_ON_APPLY
  • MINIMIZED_ENTRY_DATA
  • MINIMIZED_ON_FIELD_BOUNDARY
  • INDICATOR_FLAG
  • RECEIVER_ASP_DEVICE
  • RECEIVER_ASP_NUMBER
  • ARM_NUMBER
  • NULL_VALUE_INDICATORS
  • ENTRY_DATA

Example

  • Use the created table function to access the entry specific data from the data journal for table ORDERS in PRODLIB.
    SELECT * FROM TABLE (MYLIB.DISPLAY_JOURNAL_PRODLIB_ORDERS()); 
End of change