Your cart is currently empty!
Category: ims Db
-
Khóa học miễn phí IMS DB – SSA nhận dự án làm có lương
IMS DB – 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
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.
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.
The following images show the structures of unqualified and qualified SSAs −
Qualified 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 '')''.
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 ”)”.
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
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.
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 is a short term for MULtiple QUALIification in which we can provide boolean operators like AND or OR.
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc
Khóa học miễn phí IMS DB – Data Retrieval nhận dự án làm có lương
IMS DB – Data Retrieval
The various data retrieval methods used in IMS DL/I calls are as follows −
- GU Call
- GN Call
- Using Command Codes
- Multiple Processing
Let us consider the following IMS database structure to understand the data retrieval function calls −

GU Call
The fundamentals of GU call are as follows −
-
GU call is known as Get Unique call. It is used for random processing.
-
If an application does not update the database regularly or if the number of database updates is less, then we use random processing.
-
GU call is used to place the pointer at a particular position for further sequential retrieval.
-
GU calls are independent of the pointer position established by the previous calls.
-
GU call processing is based on the unique key fields supplied in the call statement.
-
If we supply a key field that is not unique, then DL/I returns the first segment occurrence of the key field.
CALL ''CBLTDLI'' USING DLI-GU PCB-NAME IO-AREA LIBRARY-SSA BOOKS-SSA ENGINEERING-SSA IT-SSA
The above example shows we issue a GU call by providing a complete set of qualified SSAs. It includes all the key fields starting from the root level to the segment occurrence that we want to retrieve.
GU Call Considerations
If we do not provide the complete set of qualified SSAs in the call, then DL/I works in the following way −
-
When we use an unqualified SSA in a GU call, DL/I accesses the first segment occurrence in the database that meets the criteria you specify.
-
When we issue a GU call without any SSAs, DL/I returns the first occurrence of the root segment in the database.
-
If some SSAs at intermediate levels are not mentioned in the call, then DL/I uses either the established position or the default value of an unqualified SSA for the segment.
Status Codes
The following table shows the relevant status codes after a GU call −
S.No | Status Code & Description |
---|---|
1 |
Spaces Successful call |
2 |
GE DL/I could not find a segment that met the criteria specified in the call |
GN Call
The fundamentals of GN call are as follows −
-
GN call is known as Get Next call. It is used for basic sequential processing.
-
The initial position of the pointer in the database is before the root segment of the first database record.
-
The database pointer position is before the next segment occurrence in the sequence, after a successful GN call.
-
The GN call starts through the database from the position established by the previous call.
-
If a GN call is unqualified, it returns the next segment occurrence in the database regardless of its type, in hierarchical sequence.
-
If a GN call includes SSAs, then DL/I retrieves only segments that meet the requirements of all specified SSAs.
CALL ''CBLTDLI'' USING DLI-GN PCB-NAME IO-AREA BOOKS-SSA
The above example shows we issue a GN call providing the starting position to read the records sequentially. It fetches the first occurrence of the BOOKS segment.
Status Codes
The following table shows the relevant status codes after a GN call −
S.No | Status Code & Description |
---|---|
1 |
Spaces Successful call |
2 |
GE DL/I could not find a segment that met the criteria specified in the call. |
3 |
GA An unqualified GN call moves up one level in the database hierarchy to fetch the segment. |
4 |
GB End of database is reached and segment not found. |
GK An unqualified GN call tries to fetch a segment of a particular type other than the one just retrieved but stays in the same hierarchical level. |
Command Codes
Command codes are used with calls to fetch a segment occurrence. The various command codes used with calls are discussed below.
F Command Code
Points to note −
-
When an F command code is specified in a call, the call processes the first occurrence of the segment.
-
F command codes can be used when we want to process sequentially and it can be used with GN calls and GNP calls.
-
If we specify an F command code with a GU call, it does not have any significance, as GU calls fetch the first segment occurrence by default.
L Command Code
Points to note −
-
When an L command code is specified in a call, the call processes the last occurrence of the segment.
-
L command codes can be used when we want to process sequentially and it can be used with GN calls and GNP calls.
D Command Code
Points to note −
-
D command code is used to fetch more than one segment occurrences using just a single call.
-
Normally DL/I operates on the lowest level segment specified in an SSA, but in many cases, we want data from other levels as well. In those cases, we can use the D command code.
-
D command code makes easy retrieval of the entire path of segments.
C Command Code
Points to note −
-
C command code is used to concatenate keys.
-
Using relational operators is a bit complex, as we need to specify a field name, a relational operator, and a search value. Instead, we can use a C command code to provide a concatenated key.
The following example shows the use of C command code −
01 LOCATION-SSA. 05 FILLER PIC X(11) VALUE ‘INLOCSEG*C(‘. 05 LIBRARY-SSA PIC X(5). 05 BOOKS-SSA PIC X(4). 05 ENGINEERING-SSA PIC X(6). 05 IT-SSA PIC X(3) 05 FILLER PIC X VALUE ‘)’. CALL ''CBLTDLI'' USING DLI-GU PCB-NAME IO-AREA LOCATION-SSA
P Command Code
Points to note −
-
When we issue a GU or GN call, the DL/I establishes its parentage at the lowest level segment that is retrieved.
-
If we include a P command code, then the DL/I establishes its parentage at a higher level segment in the hierarchical path.
U Command Code
Points to note −
-
When a U command code is specified in an unqualified SSA in a GN call, the DL/I restricts the search for the segment.
-
U command code is ignored if it is used with a qualified SSA.
V Command Code
Points to note −
-
V command code works similar to the U command code, but it restricts the search of a segment at a particular level and all levels above the hierarchy.
-
V command code is ignored when used with a qualified SSA.
Q Command Code
Points to note −
-
Q command code is used to enqueue or reserve a segment for exclusive use of your application program.
-
Q command code is used in an interactive environment where another program might make a change to a segment.
Multiple Processing
A program can have multiple positions in the IMS database which is known as multiple processing. Multiple processing can be done in two ways −
- Multiple PCBs
- Multiple Positioning
Multiple PCBs
Multiple PCBs can be defined for a single database. If there are multiple PCBs, then an application program can have different views of it. This method for implementing multiple processing is inefficient because of the overheads imposed by the extra PCBs.
Multiple Positioning
A program can maintain multiple positions in a database using a single PCB. This is achieved by maintaining a distinct position for each hierarchical path. Multiple positioning is used to access segments of two or more types sequentially at the same time.
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc