Ims Db 简明教程

IMS DB - DL/I Functions

DL/I 函数是 DL/I 调用中使用的第一个参数。此函数指示 IMS DL/I 调用将在 IMS 数据库上执行哪个操作。DL/I 函数的语法如下 -

DL/I function is the first parameter that is used in a DL/I call. This function tells which operation is going to be performed on the IMS database by the IMS DL/I call. The syntax of DL/I function is as follows −

01 DLI-FUNCTIONS.
   05 DLI-GU        PIC X(4)    VALUE 'GU  '.
   05 DLI-GHU       PIC X(4)    VALUE 'GHU '.
   05 DLI-GN        PIC X(4)    VALUE 'GN  '.
   05 DLI-GHN       PIC X(4)    VALUE 'GHN '.
   05 DLI-GNP       PIC X(4)    VALUE 'GNP '.
   05 DLI-GHNP      PIC X(4)    VALUE 'GHNP'.
   05 DLI-ISRT      PIC X(4)    VALUE 'ISRT'.
   05 DLI-DLET      PIC X(4)    VALUE 'DLET'.
   05 DLI-REPL      PIC X(4)    VALUE 'REPL'.
   05 DLI-CHKP      PIC X(4)    VALUE 'CHKP'.
   05 DLI-XRST      PIC X(4)    VALUE 'XRST'.
   05 DLI-PCB       PIC X(4)    VALUE 'PCB '.

此语法表示以下要点 -

This syntax represents the following key points −

  1. For this parameter, we can provide any four-character name as a storage field to store the function code.

  2. DL/I function parameter is coded in the working storage section of the COBOL program.

  3. For specifying the DL/I function, the programmer needs to code one of the 05 level data names such as DLI-GU in a DL/I call, since COBOL does not allow to code literals on a CALL statement.

  4. DL/I functions are divided into three categories: Get, Update, and Other functions. Let us discuss each of them in detail.

Get Functions

获取功能类似于任何编程语言所支持的读取操作。获取功能用于从 IMS DL/I 数据库提取段。以下获取功能用于 IMS DB 中 −

Get functions are similar to the read operation supported by any programming language. Get function is used to fetch segments from an IMS DL/I database. The following Get functions are used in IMS DB −

  1. Get Unique

  2. Get Next

  3. Get Next within Parent

  4. Get Hold Unique

  5. Get Hold Next

  6. Get Hold Next within Parent

让我们考虑以下 IMS 数据库结构以了解 DL/I 函数调用 −

Let us consider the following IMS database structure to understand the DL/I function calls −

ims database

Get Unique

“GU”代码用于唯一获取功能。它类似于 COBOL 中的随机读取语句。它用于基于字段值获取特定段出现。可以使用段搜索参数提供字段值。GU 调用的语法如下 −

'GU' code is used for the Get Unique function. It works similar to the random read statement in COBOL. It is used to fetch a particular segment occurrence based on the field values. The field values can be provided using segment search arguments. The syntax of a GU call is as follows −

CALL 'CBLTDLI' USING DLI-GU
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

如果你通过在 COBOL 程序中为所有参数提供适当的值来执行上述调用语句,你便可以在数据库中的段 I/O 区域中检索该段。在上述示例中,如果你提供图书馆、杂志和健康这三个字段值,那么你便可以获取健康段的所需出现。

If you execute the above call statement by providing appropriate values for all parameters in the COBOL program, you can retrieve the segment in the segment I/O area from the database. In the above example, if you provide the field values of Library, Magazines, and Health, then you get the desired occurrence of the Health segment.

Get Next

“GN”代码用于获取下一个功能。它类似于 COBOL 中的读取下一个语句。它用于按顺序获取段出现。访问数据段出现的预定义模式是从层次结构往下,然后从左到右。GN 调用的语法如下 −

'GN' code is used for the Get Next function. It works similar to the read next statement in COBOL. It is used to fetch segment occurrences in a sequence. The predefined pattern for accessing data segment occurrences is down the hierarchy, then left to right. The syntax of a GN call is as follows −

CALL 'CBLTDLI' USING DLI-GN
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

如果你通过在 COBOL 程序中为所有参数提供适当的值来执行上述调用语句,你便可以在数据库中按顺序在段 I/O 区域中检索段出现。在上述示例中,它首先访问图书馆段,然后访问书籍段,以此类推。我们又一次又一次地执行 GN 调用,直到达到我们想要的段出现。

If you execute the above call statement by providing appropriate values for all parameters in the COBOL program, you can retrieve the segment occurrence in the segment I/O area from the database in a sequential order. In the above example, it starts with accessing the Library segment, then Books segment, and so on. We perform the GN call again and again, until we reach the segment occurrence we want.

Get Next within Parent

“GNP”代码用于在父级内获取下一个。该函数用于按顺序检索建立父级段的从属段出现。GNP 调用的语法如下 −

'GNP' code is used for Get Next within Parent. This function is used to retrieve segment occurrences in sequence subordinate to an established parent segment. The syntax of a GNP call is as follows −

CALL 'CBLTDLI' USING DLI-GNP
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Get Hold Unique

“GHU”代码用于唯一保持获取。保持功能指定我们在检索后将更新该段。唯一保持获取功能对应于唯一获取调用。以下是 GHU 调用的语法 −

'GHU' code is used for Get Hold Unique. Hold function specifies that we are going to update the segment after retrieval. The Get Hold Unique function corresponds to the Get Unique call. Given below is the syntax of a GHU call −

CALL 'CBLTDLI' USING DLI-GHU
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Get Hold Next

“GHN”代码用于保持获取下一个。保持功能指定我们在检索后将更新该段。保持获取下一个功能对应于获取下一个调用。以下是 GHN 调用的语法 −

'GHN' code is used for Get Hold Next. Hold function specifies that we are going to update the segment after retrieval. The Get Hold Next function corresponds to the Get Next call. Given below is the syntax of a GHN call −

CALL 'CBLTDLI' USING DLI-GHN
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Get Hold Next within Parent

“GHNP”代码用于在父级内保持获取下一个。保持功能指定我们在检索后将更新该段。在父级内保持获取下一个功能对应于在父级内获取下一个调用。以下是 GHNP 调用的语法 −

'GHNP' code is used for Get Hold Next within Parent. Hold function specifies that we are going to update the segment after retrieval. The Get Hold Next within Parent function corresponds to the Get Next within Parent call. Given below is the syntax of a GHNP call −

CALL 'CBLTDLI' USING DLI-GHNP
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Update Functions

更新函数类似于其他任何编程语言中的重写或插入操作。更新函数用于更新 IMS DL/I 数据库中的段。在使用更新功能之前,必须使用保持子句成功调用段出现。以下更新函数用于 IMS DB −

Update functions are similar to re-write or insert operations in any other programming language. Update functions are used to update segments in an IMS DL/I database. Before using the update function, there must be a successful call with Hold clause for the segment occurrence. The following Update functions are used in IMS DB −

  1. Insert

  2. Delete

  3. Replace

Insert

“ISRT”代码用于插入功能。ISRT 函数用于向数据库添加一个新段。它用于更改现有数据库或加载新数据库。以下是 ISRT 调用的语法 −

'ISRT' code is used for the Insert function. The ISRT function is used to add a new segment to the database. It is used to change an existing database or load a new database. Given below is the syntax of an ISRT call −

CALL 'CBLTDLI' USING DLI-ISRT
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Delete

“DLET”代码用于删除功能。它用于从 IMS DL/I 数据库中删除一个段。以下是 DLET 调用的语法 −

'DLET' code is used for the Delete function. It is used to remove a segment from an IMS DL/I database. Given below is the syntax of a DLET call −

CALL 'CBLTDLI' USING DLI-DLET
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Replace

“REPL”代码用于在父级内保持获取下一个。替换功能用于替换 IMS DL/I 数据库中的一个段。以下是 REPL 调用的语法 −

'REPL' code is used for Get Hold Next within Parent. The Replace function is used to replace a segment in the IMS DL/I database. Given below is the syntax of an REPL call −

CALL 'CBLTDLI' USING DLI-REPL
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Other Functions

以下其他函数用于 IMS DL/I 调用 −

The following other functions are used in IMS DL/I calls −

  1. Checkpoint

  2. Restart

  3. PCB

Checkpoint

“CHKP”代码用于检查点功能。它用于IMS的恢复功能。下面给出CHKP调用的语法 −

'CHKP' code is used for the Checkpoint function. It is used in the recovery features of IMS. Given below is the syntax of a CHKP call −

CALL 'CBLTDLI' USING DLI-CHKP
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

Restart

“XRST”代码用于重启功能。它用于IMS的重启功能。下面给出XRST调用的语法 −

'XRST' code is used for the Restart function. It is used in the restart features of IMS. Given below is the syntax of an XRST call −

CALL 'CBLTDLI' USING DLI-XRST
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

PCB

PCB功能在IMS DL/I数据库中用于CICS程序。下面给出PCB调用的语法 −

PCB function is used in CICS programs in the IMS DL/I database. Given below is the syntax of a PCB call −

CALL 'CBLTDLI' USING DLI-PCB
                     PCB Mask
                     Segment I/O Area
                     [Segment Search Arguments]

有关这些功能的更多详细信息,请参见恢复章节。

You can find more details about these functions in the recovery chapter.