简体   繁体   English

如何从ILE程序中读取liblist? (最好是RPG或CL)

[英]How can I read the liblist from within an ILE-Program? (preferably RPG or CL)

We control on what objects our programs on the as400 work, by running them with different liblists. 我们通过使用不同的liblists运行它们来控制as400上的程序所使用的对象。 But some operations cannot be directly controlled by this. 但是有些操作不能由此直接控制。 Therefore, my program needs to read the liblist and decide on some of the libraries in it, how to act. 因此,我的程序需要阅读liblist并决定其中的一些库,如何操作。

I could not find any api to read the liblist entries from within a program. 我找不到任何api来从程序中读取liblist条目。 What I would expect, is some kind of api that lets me iterate through the liblist entries by priority or gives me an array with them in the order given by the liblist. 我期望的是,某种api允许我按优先级迭代liblist条目,或者按照liblist给出的顺序给我一个数组。 I'd prefer RPG or CL if possible, but other ILE languages are available, too. 如果可能的话,我更喜欢RPG或CL,但也可以使用其他ILE语言。

(If you wonder, why I'm trying to do this, I asked another question, that explaines the enclosing problem I'm faced with: How can I create a DTAQ in one of two different libs, controlled by the jobs liblist? But the liblist parsing is an approach to solve that one and is an individual problem). (如果你想知道,为什么我要这样做,我问另一个问题,解释我面临的封闭问题: 如何在两个不同的库中创建一个DTAQ,由作业liblist控制?但是liblist解析是解决这个问题的一种方法,也是一个单独的问题)。

You can use the QUSRJOBI API to retrieve the library list for a job. 您可以使用QUSRJOBI API检索作业的库列表。 You can also use the CL command ADDLIBLE and monitor for error message CPF2103 (library already exists in library list). 您还可以使用CL命令ADDLIBLE并监视错误消息CPF2103(库列表中已存在库)。

The List Objects (QUSLOBJ) API can be used to retrieve the library list. 列表对象(QUSLOBJ) API可用于检索库列表。

Object and library name 对象和库名称
When *ALLUSR is specified with a library name of *LIBL and an object type parameter of *LIB, a list of all user libraries in the thread's library name space is returned. 如果使用库名称* LIBL和对象类型参数* LIB指定* ALLUSR,则返回线程库名称空间中所有用户库的列表。 When *LIBL is specified, the auxiliary storage pool (ASP) device name must be an asterisk (*) if the auxiliary storage pool (ASP) control parameter is specified. 指定* LIBL时,如果指定了辅助存储池(ASP)控制参数,则辅助存储池(ASP)设备名称必须为星号(*)。 Refer to *ALLUSR in the description of the second 10 characters of this parameter for a definition of user libraries. 有关用户库的定义,请参阅此参数后10个字符说明中的* ALLUSR。

The Change Library List (QLICHGLL) API can be used to change the library list. 更改库列表(QLICHGLL) API可用于更改库列表。

The RTVJOBA command can retrieve the SYSLIBL , CURLIB , and USRLIBL . RTVJOBA命令可以检索SYSLIBLCURLIBUSRLIBL


The book APIs at work, Chapter 3, List APIs has a lot of information that may help you. 工作中的书API,第3章,列表API有很多可以帮助您的信息。

A simpler alternative approach might be worthwhile, depending on your situation. 根据您的具体情况,更简单的替代方法可能是值得的。 If you know the target libraries in advance, perhaps you could create a data area in each of those libraries, containing the library name. 如果您事先知道目标库,也许您可​​以在每个库中创建一个包含库名称的数据区域。 Your program will read whichever data area it finds first on the library list, and will give you the name of the library for you to create your data queue. 您的程序将读取它首先在库列表中找到的任何数据区域,并为您提供用于创建数据队列的库的名称。

It's not sophisticated, but it is effective and very simple, and also therefore easier to code/debug/maintain. 它不复杂,但它有效且非常简单,因此更容易编码/调试/维护。

Kratenko, if you want simpler and lesser code alternative than API. Kratenko,如果你想要比API更简单和更少的代码。 Create simple CL pgm that you can call within your rpg. 创建可以在RPG中调用的简单CL pgm。 Your cl can have RTVJOBA (there's parm to get libl). 你的cl可以有RTVJOBA(有了parm来获取libl)。 You might get many libs from that, and you need to parse and identify the specific lib you want? 你可能会从中获得很多库,你需要解析并识别你想要的特定库吗? About identifying you must know one of the qualifiers. 关于识别您必须知道其中一个限定符。 Do you want the lib where your pgm runs or the lib where "some" file resides? 你想要你的pgm运行的lib或“some”文件所在的lib吗? If yes on any, then you can use RTVOBJD to get specific lib. 如果是,那么您可以使用RTVOBJD来获取特定的lib。 Then use that lib in your CRTDTAQ cmds. 然后在CRTDTAQ cmds中使用该lib。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM