Three attributes are assigned when a TSO report is created that determine whether it will show up in a user's selection lists:
Environment defines the environment in which the report can run. Only TSO programs and batch programs show up in selection lists when using the End User Facility under TSO.
Shared Status defines the authorization level of the report. Shared reports are available to all users. If a report is defined as restricted, then use of the report is limited to authorized users.
The third attribute is Report Owner. Users are authorized to use a report (regardless of its Shared Status) if they can set their CURRENT SQLID to the owner of the report.
Therefore, if the current report owner (CURRENT-REPORT-OWNER) is a valid CURRENT SQLID, then this SQL statement is used to select reports from Q.REPORTS:
SELECT ... FROM Q.REPORT WHERE ENVIRONMENT IN ('T', 'B' AND REPORT_OWNER = :CURRENT-REPORT-OWNED
If the current report owner is not a valid CURRENT SQLID, then this SQL statement is used to select reports from Q.REPORTS:
SELECT ... FROM Q.REPORTS WHERE ENVIRONMENT IN ('T', 'B') AND REPORT_OWNER = :CURRENT-REPORT-OWNER AND SHARED = 'Y'