Specifying the DB PCB mask
IMS describes the results of the calls your program issues in the DB PCB that is referenced in the call. To determine the success or failure of the DL/I call, the application program includes a mask of the DB PCB and then references the fields of the DB PCB through the mask.
A DB PCB mask must contain the fields shown in the following table. (Your program can look at, but not change, the fields in the DB PCB.) The fields in your DB PCB mask must be defined in the same order and with the same length as the fields shown here. When you code the DB PCB mask, you also give it a name, but the name is not part of the mask. You use the name (or the pointer, for PL/I) when you reference each of the PCBs your program processes. A GSAM DB PCB mask is slightly different from other DB PCB masks.
Of the nine fields, only five are important to you as you construct the program. These
are the fields that give information about the results of the call. They are the segment level
number, status code, segment name, length of the key feedback area, and key feedback area. The
status code is the field your program uses most often to find out whether the call was successful.
The key feedback area contains the data from the segments you have specified; the level number and
segment name help you determine the segment type you retrieved after an unqualified
GN
or GNP
call, or they help you determine your position in the
database after an error or unsuccessful call.
Descriptor | Byte Length | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
---|---|---|---|---|---|---|
Database name 1 | 8 | X | X | X | ||
Segment level number 2 | 2 | X | X | X | ||
Status code 3 | 2 | X | X | X | ||
Processing options 4 | 4 | X | X | X | ||
Reserved for IMS 5 | 4 | X | X | X | ||
Segment name 6 | 8 | X | X | X | ||
Length of key |
4 | X | X | X | ||
Number of sensitive segments 8 | 4 | X | X | X | ||
Key feedback area 9 | var length | X | X | X |
This contains the name of the database. This field is 8 bytes long and contains character data.
- Segment Level Number
This field contains numeric character data. It is 2 bytes long and right-justified. When IMS retrieves the segment you have requested, IMS places the level number of that segment in this field. If you are retrieving several segments in a hierarchic path with one call, IMS places the number of the lowest-level segment retrieved. If IMS is unable to find the segment that you request, it gives you the level number of the last segment it encounters that satisfied your call.
-
Status Code
After each DL/I call, this field contains the two-character status code that describes the results of the DL/I call. IMS updates this field after each call and does not clear it between calls. The application program should test this field after each call to find out whether the call was successful.
When the program is initially scheduled, this field contains a data-availability status code, which indicates any possible access constraint based on segment sensitivity and processing options.
Related Reading: For more information on these status codes, see the topic "INIT Call" in IMS Version 15.2 Application Programming APIs.
During normal processing, four categories of status codes exist:
- Successful or exceptional but valid conditions. If the call was completely successful, this field contains blanks. Many of the codes in this category are for information only. For example, GB means that IMS has reached the end of the database without satisfying the call. This situation is expected in sequential processing and is not usually the result of an error.
- Errors in the program. For example, AK means that you have included an invalid field name in a segment search argument (SSA). Your program should have error routines available for these status codes. If IMS returns an error status code to your program, your program should terminate. You can then find the problem, correct it, and restart your program.
- I/O or system error. For example, an AO status code means that there has been an I/O error concerning OSAM, BSAM, or VSAM. If your program encounters a status code in this category, it should terminate immediately. This type of error cannot normally be fixed without a system programmer, database administrator, or system administrator.
- Data-availability status codes. These are returned only if your program has issued the
INIT
call indicating that it is prepared to handle such status codes.Status Code Explanations
in IMS Version 15.2 Messages and Codes, Volume 4: IMS Component Codes describes possible causes and corrections in more detail.
- Processing Options
This is a 4-byte field containing a code that tells IMS what type of calls this program can issue. It is a security mechanism in that it can prevent a particular program from updating the database, even though the program can read the database. This value is coded in the PROCOPT parameter of the PCB statement when the PSB for the application program is generated. The value does not change.
- Reserved for IMS
This 4-byte field is used by IMS for internal linkage. It is not used by the application program.
- Segment Name
After each successful call, IMS places in this field the name of the last segment that satisfied the call. When a retrieval is successful, this field contains the name of the retrieved segment. When a retrieval is unsuccessful, this field contains the last segment along the path to the requested segment that would satisfy the call. The segment name field is 8 bytes long.
When a program is initially scheduled, the name of the database type is put in the SEGNAME field. For example, the field contains DEDB when the database type is DEDB; GSAM when the database type is GSAM; HDAM, or PHDAM when the database type is HDAM or PHDAM.
- Length of Key Feedback Area
This is a 4-byte binary field that gives the current length of the key feedback area. Because the key feedback area is not usually cleared between calls, the program needs to use this length to determine the length of the relevant current concatenated key in the key feedback area.
- Number of Sensitive Segments
This is a 4-byte binary field that contains the number of segment types in the database to which the application program is sensitive.
- Key Feedback Area
At the completion of a retrieval or
ISRT
call, IMS places the concatenated key of the retrieved segment in this field. The length of the key for this request is given in the 4-byte field. If IMS is unable to satisfy the call, the key feedback area contains the key of the segment at the last level that was satisfied. A segment's concatenated key is made up of the keys of each of its parents and its own key. Keys are positioned left to right, starting with the key of the root segment and following the hierarchic path. IMS does not normally clear the key feedback area. IMS sets this length of the key feedback area to indicate the portion of the area that is valid at the completion of each call. Your program should not use the content of the key feedback area that is not included in the key feedback area length.