Ims Db 简明教程
IMS DB - Programming
包含 DL/I 调用的应用程序不能直接执行。相反,需要一个 JCL 来触发 IMS DL/I 批处理模块。IMS 中的批处理初始化模块是 DFSRRC00。应用程序和 DL/I 模块一起执行。下图显示了包含 DL/I 调用以访问数据库的应用程序的结构。
An application program which includes DL/I calls cannot execute directly. Instead, a JCL is required to trigger the IMS DL/I batch module. The batch initialization module in IMS is DFSRRC00. The application program and the DL/I module execute together. The following diagram shows the structure of an application program which includes DL/I calls to access a database.

应用程序通过以下程序元素与 IMS DL/I 模块进行接口 −
The application program interfaces with IMS DL/I modules via the following program elements −
-
An ENTRY statement specifies that the PCBs are utilized by the program.
-
A PCB-mask co-relates with the information preserved in the pre-constructed PCB which receives return information from the IMS.
-
An Input-Output Area is used for passing data segments to and from the IMS database.
-
Calls to DL/I specify the processing functions such as fetch, insert, delete, replace, etc.
-
Check Status Codes is used to check the SQL return code of the processing option specified to inform whether the operation was successful or not.
-
A Terminate statement is used to end the processing of the application program which includes the DL/I.
Segments Layout
到目前为止,我们了解到 IMS 由在高级编程语言中用于访问数据的段组成。考虑一下我们之前见过的图书馆的以下 IMS 数据库结构,这里我们将在 COBOL 中看到其段的布局 −
As of now, we learnt that the IMS consists of segments which are used in high-level programming languages to access data. Consider the following IMS database structure of a Library which we have seen earlier and here we see the layout of its segments in COBOL −

01 LIBRARY-SEGMENT.
05 BOOK-ID PIC X(5).
05 ISSUE-DATE PIC X(10).
05 RETURN-DATE PIC X(10).
05 STUDENT-ID PIC A(25).
01 BOOK-SEGMENT.
05 BOOK-ID PIC X(5).
05 BOOK-NAME PIC A(30).
05 AUTHOR PIC A(25).
01 STUDENT-SEGMENT.
05 STUDENT-ID PIC X(5).
05 STUDENT-NAME PIC A(25).
05 DIVISION PIC X(10).
Application Program Overview
IMS 应用程序的结构不同于非 IMS 应用程序的结构。IMS 程序不能直接执行,但是它总是作为子程序被调用。IMS 应用程序包含程序规范块,以便查看 IMS 数据库。
The structure of an IMS application program is different from that of a Non-IMS application program. An IMS program cannot be executed directly; rather it is always called as a subroutine. An IMS application program consists of Program Specification Blocks to provide a view of the IMS database.
当我们执行包含 IMS DL/I 模块的应用程序时,将装入该程序相关的应用程序和 PSB。然后,IMS 模块将执行由应用程序触发的 CALL 请求。
The application program and the PSBs linked to that program are loaded when we execute an application program which includes IMS DL/I modules. Then the CALL requests triggered by the application programs are executed by the IMS module.