Ims Db 简明教程
IMS DB - Data Manipulation
IMS DL/I 调用中使用的不同数据操作方法如下:
The different data manipulation methods used in IMS DL/I calls are as follows −
-
ISRT Call
-
Get Hold Calls
-
REPL Call
-
DLET Call
让我们考虑以下 IMS 数据库结构以了解数据操作函数调用:
Let us consider the following IMS database structure to understand the data manipulation function calls −
ISRT Call
重点注意事项:
Points to note −
-
ISRT call is known as Insert call which is used to add segment occurrences to a database.
-
ISRT calls are used for loading a new database.
-
We issue an ISRT call when a segment description field is loaded with data.
-
An unqualified or qualified SSA must be specified in the call so that the DL/I knows where to place a segment occurrence.
-
We can use a combination of both unqualified and qualified SSA in the call. A qualified SSA can be specified for all the above levels. Let us consider the following example −
CALL 'CBLTDLI' USING DLI-ISRT
PCB-NAME
IO-AREA
LIBRARY-SSA
BOOKS-SSA
UNQUALIFIED-ENGINEERING-SSA
上面的示例表明我们正通过提供限定和未限定 SSA 的组合来发出 ISRT 调用。
The above example shows we are issuing an ISRT call by providing a combination of qualified and unqualified SSAs.
当我们正在插入的新段具有唯一键字段时,它将被添加到适当的位置。如果键字段不是唯一的,那么将按照数据库管理员定义的规则添加它。
When a new segment that we are inserting has a unique key field, then it is added at the proper position. If the key field is not unique, then it is added by the rules defined by a database administrator.
当我们发出一个 ISRT 调用而没有指定关键字段时,插入规则会告诉我们如何将段相对于现有的孪生段放置。下面给出插入规则——
When we issue an ISRT call without specifying a key field, then the insert rule tells where to place the segments relative to existing twin segments. Given below are the insert rules −
-
First − If the rule is first, the new segment is added before any existing twins.
-
Last − If the rule is last, the new segment is added after all existing twins.
-
Here − If the rule is here, it is added at the current position relative to existing twins, which may be first, last, or anywhere.
Status Codes
下表显示了 ISRT 调用后的相关状态代码——
The following table shows the relevant status codes after an ISRT call −
S.No |
Status Code & Description |
1 |
Spaces Successful call |
2 |
GE Multiple SSAs are used and the DL/I cannot satisfy the call with the specified path. |
3 |
II Try to add a segment occurrence that is already present in the database. |
4 |
LB / LC LD / LE We get these status codes while load processing. In most cases, they indicate that you are not inserting the segments in an exact hierarchical sequence. |
Get Hold Call
重点注意事项:
Points to note −
-
There are three types of Get Hold call which we specify in a DL/I call: Get Hold Unique (GHU) Get Hold Next (GHN) Get Hold Next within Parent (GHNP)
-
Hold function specifies that we are going to update the segment after retrieval. So before an REPL or DLET call, a successful hold call must be issued telling the DL/I an intent to update the database.
REPL Call
重点注意事项:
Points to note −
-
After a successful get hold call, we issue an REPL call to update a segment occurrence.
-
We cannot change the length of a segment using an REPL call.
-
We cannot change the value of a key field using an REPL call.
-
We cannot use a qualified SSA with an REPL call. If we specify a qualified SSA, then the call fails.
CALL 'CBLTDLI' USING DLI-GHU
PCB-NAME
IO-AREA
LIBRARY-SSA
BOOKS-SSA
ENGINEERING-SSA
IT-SSA.
*Move the values which you want to update in IT segment occurrence*
CALL ‘CBLTDLI’ USING DLI-REPL
PCB-NAME
IO-AREA.
上面的示例使用 REPL 调用更新 IT 段出现。首先,我们发出一个 GHU 调用来获取要更新的段出现。然后,我们发出一个 REPL 调用来更新该段的值。
The above example updates the IT segment occurrence using an REPL call. First, we issue a GHU call to get the segment occurrence we want to update. Then, we issue an REPL call to update the values of that segment.
DLET Call
重点注意事项:
Points to note −
-
DLET call works much in the same way as an REPL call does.
-
After a successful get hold call, we issue a DLET call to delete a segment occurrence.
-
We cannot use a qualified SSA with a DLET call. If we specify a qualified SSA, then the call fails.
CALL 'CBLTDLI' USING DLI-GHU
PCB-NAME
IO-AREA
LIBRARY-SSA
BOOKS-SSA
ENGINEERING-SSA
IT-SSA.
CALL ‘CBLTDLI’ USING DLI-DLET
PCB-NAME
IO-AREA.
上面的示例使用 DLET 调用删除 IT 段出现。首先,我们发出一个 GHU 调用来获取要删除的段出现。然后,我们发出一个 DLET 调用来更新该段的值。
The above example deletes the IT segment occurrence using a DLET call. First, we issue a GHU call to get the segment occurrence we want to delete. Then, we issue a DLET call to update the values of that segment.
Status Codes
以下表格显示 REPL 或 DLET 调用之后的相关状态代码 −
The following table shows the relevant status codes after an REPL or a DLET call −
S.No |
Status Code & Description |
1 |
Spaces Successful call |
2 |
AJ Qualified SSA used on REPL or DLET call. |
3 |
DJ Program issues a replace call without an immediately preceding get hold call. |
4 |
DA Program makes a change to the segment’s key field before issuing the REPL or DLET call |