Ims Db 简明教程
IMS DB - SSA
SSA 表示段搜索参数。SSA 用于标识被访问的段发生。它是一个可选参数。我们可以根据要求包含任意数量的 SSA。SSA 有两种类型 −
SSA stands for Segment Search Arguments. SSA is used to identify the segment occurrence being accessed. It is an optional parameter. We can include any number of SSAs depending on the requirement. There are two types of SSAs −
-
Unqualified SSA
-
Qualified SSA
Unqualified SSA
不合格 SSA 提供了在调用中所使用段的名称。下面给出了不合格 SSA 的语法 −
An unqualified SSA provides the name of the segment being used inside the call. Given below is the syntax of an unqualified SSA −
01 UNQUALIFIED-SSA.
05 SEGMENT-NAME PIC X(8).
05 FILLER PIC X VALUE SPACE.
不合格 SSA 的要点如下 −
The key points of unqualified SSA are as follows −
-
A basic unqualified SSA is 9 bytes long.
-
The first 8 bytes hold the segment name which is being used for processing.
-
The last byte always contains space.
-
DL/I uses the last byte to determine the type of SSA.
-
To access a particular segment, move the name of the segment in the SEGMENT-NAME field.
以下图像显示了不合格和合格的 SSA 的结构 −
The following images show the structures of unqualified and qualified SSAs −
Qualified SSA
合格的 SSA 为区段提供了特定数据库区段发生的区段类型。以下是合格 SSA 的语法 −
A Qualified SSA provides the segment type with the specific database occurrence of a segment. Given below is the syntax of a Qualified SSA −
01 QUALIFIED-SSA.
05 SEGMENT-NAME PIC X(8).
05 FILLER PIC X(01) VALUE '('.
05 FIELD-NAME PIC X(8).
05 REL-OPR PIC X(2).
05 SEARCH-VALUE PIC X(n).
05 FILLER PIC X(n+1) VALUE ')'.
合格的SSA的主要内容如下−
The key points of qualified SSA are as follows −
-
The first 8 bytes of a qualified SSA holds the segment name being used for processing.
-
The ninth byte is a left parenthesis '('.
-
The next 8 bytes starting from the tenth position specifies the field name which we want to search.
-
After the field name, in the 18th and 19th positions, we specify two-character relational operator code.
-
Then we specify the field value and in the last byte, there is a right parenthesis ')'.
下表显示了合格的SSA中使用的关系运算符。
The following table shows the relational operators used in a Qualified SSA.
Relational Operator |
Symbol |
Description |
EQ |
= |
Equal |
NE |
~= ˜ |
Not equal |
GT |
> |
Greater than |
GE |
>= |
Greater than or equal |
LT |
<< |
Less than |
LE |
⇐ |
Less than or equal |
Command Codes
命令代码用于增强DL/I调用的功能。命令代码减少了DL/I调用的数量,使程序变得简单。此外,它提高了性能,这是因为减少了调用的数量。下图显示了在不合格和合格的SSA中如何使用命令代码−
Command codes are used to enhance the functionality of DL/I calls. Command codes reduce the number of DL/I calls, making the programs simple. Also, it improves the performance as the number of calls is reduced. The following image shows how command codes are used in unqualified and qualified SSAs −
命令代码的主要要点如下−
The key points of command codes are as follows −
-
To use command codes, specify an asterisk in the 9th position of the SSA as shown in the above image.
-
Command code is coded at the tenth position.
-
From 10th position onwards, DL/I considers all characters to be command codes until it encounters a space for an unqualified SSA and a left parenthesis for a qualified SSA.
下表显示了SSA中使用的命令代码列表−
The following table shows the list of command codes used in SSA −
Command Code |
Description |
C |
Concatenated Key |
D |
Path Call |
F |
First Occurrence |
L |
Last Occurrence |
N |
Path Call Ignore |
P |
Set Parentage |
Q |
Enqueue Segment |
U |
Maintain Position at this level |
V |
Maintain Position at this and all above levels |
- |
Null Command Code |
Multiple Qualifications
多重限定的基本要点如下 −
The fundamental points of multiple qualifications are as follows −
-
Multiple qualifications are required when we need to use two or more qualifications or fields for comparison.
-
We use Boolean operators like AND and OR to connect two or more qualifications.
-
Multiple qualifications can be used when we want to process a segment based on a range of possible values for a single field.
以下是多重限定的语法 −
Given below is the syntax of Multiple Qualifications −
01 QUALIFIED-SSA.
05 SEGMENT-NAME PIC X(8).
05 FILLER PIC X(01) VALUE '('.
05 FIELD-NAME1 PIC X(8).
05 REL-OPR PIC X(2).
05 SEARCH-VALUE1 PIC X(m).
05 MUL-QUAL PIC X VALUE '&'.
05 FIELD-NAME2 PIC X(8).
05 REL-OPR PIC X(2).
05 SEARCH-VALUE2 PIC X(n).
05 FILLER PIC X(n+1) VALUE ')'.
MUL-QUAL 是 MULtiple QUALIification 的简称,其中我们可以提供布尔运算符,如 AND 或 OR。
MUL-QUAL is a short term for MULtiple QUALIification in which we can provide boolean operators like AND or OR.