In this topic, we described about the below sections -
IMS provides the methods to retrieve the database segments. Segments in an IMS database can be retrieved in two ways.
- Sequential processing
- Random processing
The data base is processed in sequence from starting point placed.The order of the segments retrieval is determined by their physical order on the database. The search for the next segment starts at the current position. The segment retrieved based on the below factors:
- The hierarchy of database.
- The qualification used in the application.
- The segments that have defined in the PCB, i.e., segment sensitivity.
Sequential Processing Functions:
|GN||Get Next Segment in sequential order. Retrieves subsequent segments sequentially. Call with Get Next (GN) is used to retrieve segments sequentially from the database. GN call can be explained in detail here .|
|GNP||Get Hold Next segment in Parent. Retrieves dependent segments sequentially. Call with Get Next in Parent (GNP) is used to retrieve dependent segments sequentially. GNP call can be explained in detail here .|
|GHN||Get Hold Next Segment. Retrieves subsequent segments from the database. Call with Get Hold Next (GHN) is the holding segment for a GN call. GHN call can be explained in detail here .|
|GHNP||Get Hold Next segment in Parent. Retrieves dependents sequentially. Call with Get Hold Next in Parent (GHNP) is the hold segment for the GNP call. GHNP call can be explained in detail here .|
The database segments can be retrieved in any order. The application program requests for a specific segment that needs to be identified by some field in the segment.
In addition to retrieval, an application program can Add, Change or Delete segments. The segment is always retrieved directly in random processing.
The database position has no impact on the call. The retrieval can move forward, backward, or stays in the current position. The segment can be retrieved based on the below ways:
- If a key is specified, the segment returned matches that key
- If the segment name is used, IMS returns the first segment of that type
- If no qualification is specified, IMS returns the first segment in the database
Random processing and retrieval accomplishes the below things:
- Sets parentage
- Sets database position after the retrieved segment
- Retrieves the segment(s)
Random Processing Functions:
|GU(Get Unique)||Get Unique Segment. Retrieves unique segments and establishes a starting position in the database. Call with Get Unique (GU) is used to directly retrieve segments.
And also to establish the starting position in the database for sequential processing. GU call can be explained in detail here .
|GHU(Get Hold Unique)||Get Hold Unique Segment . Retrieves matching segments and establishes a starting position in the database. Call with Get Hold Unique (GHU) is the hold segment for a GU call.
Remember that when using EXEC DLI, no hold is necessary. GHU call can be explained in detail here.