系统 i SQL 来自 IFS 的流文件

System i SQL stream file from IFS

IBM System i V7R3M0 我想用 SQL 提取一个 .json 文件。 SQL 无法解析 QSYS2.IFS_READ。

select x.id, x.username, x.firstName, x.lastName, x.email 
from json_table(
 QSYS2.IFS_READ(PATH_NAME => '/FileTransferData/userList.json'), 
 'lax $' columns (
  id INTEGER PATH 'lax $.id',
  username VARCHAR(30) FORMAT JSON PATH 'lax $.username',
  firstName VARCHAR(30) FORMAT JSON PATH 'lax $.firstName',
  lastName VARCHAR(30) FORMAT JSON PATH 'lax $.lastName',
  email VARCHAR(75) FORMAT JSON PATH 'lax $.email'
 )
)
as x;

错误是:

SQL State: 42704
Vendor Code: -204
Message: [SQL0204] IFS_READ in QSYS2 type *N not found. Cause . . . . . :   IFS_READ in QSYS2 type *N was not found. 

QZDASOINIT 中的作业日志告诉我同样的事情,我在 QSYS2

中没有 IFS_READ
Job 111566/QUSER/QZDASOINIT started on 04/12/21 at 12:23:06 in subsystem QUSRWRK in QSYS. Job entered system on 04/12/21 at 12:23:06.
User MOLNARJ from client 10.111.0.24 connected to server.
The following special registers have been set: CLIENT_ACCTNG: ,
  CLIENT_APPLNAME: System i Navigator - Run SQL Scripts, CLIENT_PROGRAMID:
  cwbunnav.exe, CLIENT_USERID: MOLNARJ, CLIENT_WRKSTNNAME:
  FS2ISYMOB943.umassmemorial.org
Trigger Q__OSYS_QAQQINI_BEFORE_INSERT_______ in library QTEMP was added to file QAQQINI in library QTEMP.
Trigger Q__OSYS_QAQQINI_AFTER_INSERT________ in library QTEMP was added to file QAQQINI in library QTEMP.
Trigger Q__OSYS_QAQQINI_BEFORE_UPDATE_______ in library QTEMP was added to file QAQQINI in library QTEMP.
Trigger Q__OSYS_QAQQINI_AFTER_UPDATE________ in library QTEMP was added to  file QAQQINI in library QTEMP.
Trigger Q__OSYS_QAQQINI_BEFORE_DELETE_______ in library QTEMP was added to
  file QAQQINI in library QTEMP.
Trigger Q__OSYS_QAQQINI_AFTER_DELETE________ in library QTEMP was added to file QAQQINI in library QTEMP.
Object QAQQINI in QTEMP type *FILE created.
1 objects duplicated.
IFS_READ in QSYS2 type *N not found.

我进退两难。我的外包支持公司声称 我需要创建一个程序来利用 API。但是,我相信 API 没有安装。

我的工作基于 IBM 技术文档,例如: https://www.ibm.com/docs/en/i/7.4?topic=is-ifs-read-ifs-read-binary-ifs-read-utf8-table-functions

运行本文档中的示例(文件路径和名称更改为我的)给出相同的错误。

SELECT * FROM TABLE(QSYS2.IFS_READ(PATH_NAME => '/FileTransferData/userList.json', END_OF_LINE => 'CRLF'));

This link 表示需要 PTF SF99703 级别 22。您可以检查已安装或可用的内容:

with iLevel(iVersion, iRelease) as (
select
    OS_VERSION, OS_RELEASE
from
    sysibmadm.env_sys_info )
select
    case PTF_GROUP_CURRENCY when 'INSTALLED LEVEL IS CURRENT' then '' else PTF_GROUP_CURRENCY end,
    PTF_GROUP_ID "ID",
    PTF_GROUP_TITLE "Title",
    PTF_GROUP_LEVEL_INSTALLED "Installed",
    PTF_GROUP_LEVEL_AVAILABLE "Available",
    ptf_group_level_available - ptf_group_level_installed "Diff",
    date(to_date(PTF_GROUP_LAST_UPDATED_BY_IBM, 'MM/DD/YYYY')) "Available since",
    current date - date(to_date(PTF_GROUP_LAST_UPDATED_BY_IBM, 'MM/DD/YYYY')) "Days since available",
    PTF_GROUP_RELEASE "Release",
    PTF_GROUP_STATUS_ON_SYSTEM "Status"
from
    iLevel,
    systools.group_ptf_currency P
where
    ptf_group_id = 'SF99703'
order by
    ptf_group_level_available - ptf_group_level_installed desc;