暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

IBM 一些系统table的妙用。

啊皮 2021-07-29
837

1>拿到当前system时间

(You can use any of the SYSDUMMYxtables when you need to write a query, but no data from a table is referenced. In any query, you must specify a table reference in the FROM clause, but if the query does not reference any data from the table, it does not matter which table is referenced in the FROM clause. Each of the SYSDUMMYxtables contains one row, so a SYSDUMMYxtable can be referenced in a SELECT INTO statement without the need for a predicate to limit the result to a single row of data)


    SELECT NOW() FROM SYSIBM/SYSDUMMY1
    SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1
    SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY1



    2>从journal recevier 拿到特定user的记录

    (The DISPLAY_JOURNAL table function returns information about journal entries. It returns information similar to what is returned by the Display Journal (DSPJRN) CL command and the Retrieve Journal Entries (QjoRetrieveJournalEntries) API)


      SELECT *                          
      FROM TABLE (QSYS2.DISPLAY_JOURNAL(
      'QSYS' , 'QAUDJRN' ,
      JOURNAL_ENTRY_TYPES=>'DO' ,
      STARTING_RECEIVER_NAME=>'*CURCHAIN'
      )) AS JDO
      where job_User = 'AMAPICS'



      3>按内存使用大小排序用户

      The USER_STORAGE view contains details about storage by user profile.

      The user storage consumption detail is determined by using Retrieve User Information (QSYRUSRI) API.

      You must have *OBJOPR and *READ authority to a *USRPRF or it will not be returned. To see information for independent ASPs (iASPs), the iASP must be varied on.

      User storage is broken down by SYSBAS and iASPs.


        SELECT AUTHORIZATION_NAME, STORAGE_USED,  
        DENSE_RANK()
        OVER (ORDER BY storage_used DESC ) AS rank
        FROM
        QSYS2/USER_STORAGE




        4>查询当前作业的日志(便于保存分析)

        (The JOBLOG_INFO table function returns one row for each message in a job log.)


          SELECT MESSAGE_TEXT FROM          
          TABLE(QSYS2.JOBLOG_INFO('*')) A
          WHERE A.MESSAGE_TYPE = 'REQUEST'
          ORDER BY ORDINAL_POSITION DESC
          FETCH FIRST 100 ROW ONLY


          更多具体table讲解和使用,可以参考IBM官网(非常非常详细的链接)


                            


          后台回复 IBM7.2 

          可以获取详细链接。


          文章转载自啊皮,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

          评论