IMS DB Get Hold Next(GHN) Call
Called as Get Hold Next
Used to retrieve and hold (for update/delete) the next segment.
CALL ‘CBLTDLI’ USING GHN DB PCB/AIB I/O Area SSA
Lets discuss about individual parameters.
- Database Program Control Block
- Specifies the DB PCB for the GHN call.
- DB PCB will act as an input and output parameter.
- Known as Application Interface Block.
- Specifies the AIB for the call.
- AIB parameter is an input and output parameter.
- If AIB using in the GHN call, all the below fields must be initialized in the AIB - AIBID, AIBLEN, AIBRSNM1, AIBOALEN.
- Known as Input-Output Area.
- Specifies the I/O area in GHN Call.
- I/O Area parameter is an output parameter.
- If Replace calls completed successfully, IMS returns the requested segment in I/O area.
- If any path calls issued from the application program, the I/O area must be long enough to hold the longest path of concatenated segments.
- I/O area always contains left-justified segment data.
- The I/O area points to the first byte of this area.
- Known as Segment Search Arguments.
- Specifies to be used in the call.
- SSA parameter is an input parameter.
- The SSA supplies in the call to data areas in the application program where the SSA has been defined for the call.
- Up to 15 SSAs can be used in the parameter.
- SSA parameter is optional for the GHN call.
- Specifies the area in application program where the RSA for the record should be returned.
- RSA output parameter is used for GSAM only.
- RSA parameter is optional for GHN call.
Before your program can delete or replace a segment, the segment must be retrieved with HOLD option to lock it.
The application program should issue a Get call with a "hold" before deleting or replacing the segment.
If the application program has successfully retrieved the segment with a Get Hold call, it can delete the segment or change one or more fields (except the key field) in the segment.
The difference between Get calls with a hold and Get calls without a hold is that the hold calls can be followed by REPL or DLET for Get hold calls.
The hold status on the retrieved segment should be canceled and reestablished before the application program reissue the DLET or REPL call.
After issuing a Get Hold call, application program issue more than one REPL or DLET call to the segment if application program do not issue overriding calls to the same PCB.
If application program do not need to update the segment after issuing a Get Hold call, program can continue with other processing without releasing the segment.
The segment is freed as soon as the current position changes when application program issues another call to the same PCB that application program used for the Get Hold call.
A Get Hold call must go before a REPL or DLET call.
Issuing a Get Hold call does not require to replace or delete the segment.
GE - Not found
GHN returns the GE status code if the below conditions occurred,
- The value of the key in the SSA has an upper limit ( i.e. <= set)
- A segment with a key greater than the value in the SSA is found in a sequential search.
GB - End of the Database
IMS returns the GB status code if the sequential search reaches to End of the database without finding the required segment.
IMSDB Get Next(GN) IMSDB Get Next within Parent(GNP)