If at all, the data of a segment needs to be modified or deleted, the details needs to be retrieved with a hold on the segment occurrence, so that no other person can do the similar operation on that. To achieve this there are three function codes for the Get-Hold retrieval calls. They are.
GHU - Get-Hold-Unique
GHN - Get-Hold-Next
GHNP - Get-Hold-Next-within-Parent
The above three function codes perform similar functions as that of the three retrieval calls (GU, GN, GNP). The Get-Hold-Unique call corresponds to the Get-Unique call, the Get-Hold-Next call corresponds to the Get-Next call, and Get-Hold-Next-within-Parent call corresponds to Get-Next-within-Parent call.
The Get-Hold call brings the segment occurrence into the I/O area and also causes IMS to save information about the segment. The program can then examine the segment image in I/O area and decide whether the segment occurrence needs to be deleted or replaced. No other calls are allowed that reference the same PCB, between the time that the program issues the Get-Hold call and the time that it issues the Delete or Replace call.
If the program issues a call other than a Delete or Replace, that call nullifies the effect of the Get-Hold call and the program is then not allowed to issue a Delete or Replace call until another Get-Hold call is issued.
The same types of SSAs are used with Get-Hold calls as are used with non-hold Get calls. The status codes that IMS returns are also identical. The only difference between Get-Hold calls and Get calls is that with Get-hold calls the program is allowed to follow the call with a delete or replace call. Following a non-hold get call with a delete or replace is not allowed.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!