Start of change

USER_SPACE table function

The USER_SPACE table function returns the contents of the specified user space (*USRSPC). The data is returned as character and binary data.

The values returned for the result columns of the table function are closely related to the values returned by the Retrieve User Space (QUSRTVUS) API.

Authorization: The caller must have:
  • *EXECUTE authority for the library, and
  • *USE authority for the user space.
Read syntax diagramSkip visual syntax diagramUSER_SPACE( USER_SPACE => user-space,USER_SPACE_LIBRARY => user-space-library )

The schema is QSYS2.

user-space
A character or graphic string containing the name of the user space.
user-space-library
A character or graphic string containing the name of the library containing the user space. Can be one of the following special values:
*CURLIB
The job's current library is used.
*LIBL
The library list is used. This is the default.

The result of the function is a table containing one row with the format shown in the following table. All the columns are nullable.

Table 1. USER_SPACE table function
Column Name Data Type Description
USER_SPACE_LIBRARY VARCHAR(10) The library in which the user space was found.
USER_SPACE VARCHAR(10) The name of the user space.
DATA CLOB(16M) The data from the user space as character data.
DATA_BINARY BLOB(16M) The data from the user space in binary form. This is the raw form of the data.

Example

Look at the untranslated contents of user space USERSPC1 in TESTLIB.


SELECT DATA_BINARY FROM TABLE(QSYS2.USER_SPACE(
                                               USER_SPACE => 'USRSPACE1', 
                                               USER_SPACE_LIBRARY => 'TESTLIB'));
  
End of change