Segments can be updated by application programs and returned to IMS to be restored in the database with the Replace call (REPL Call in IMS), function code REPL.
Conditions to Update a SEGMENT
- The segment must first be retrieved with a Get Hold call (GHU or GHN). No intervening calls can reference the same PCB.
- The Sequence field of the segment cannot be changed. You can change the sequence field of the segment only by using combinations of Delete and Insert calls for the segment and all its dependents.
Hint: Notice that the Replace call must not specify an SSA for the segment to be replaced. If, after retrieving a segment with a Get Hold call, the program decides not to update the segment, it need not issue a Replace call. Instead, the program can proceed as if it were a normal Get call without the hold.
Use the Get Hold call whenever there is a reasonable chance (5% or greater) that you will change the segment.
The difference in performance between the Get call and the Get Hold call is minimal.
Syntax for IMS REPL call
77 GHU-FUNC PICTURE XXXX VALUE 'GHU'. 77 REPL-FUNC PICTURE XXXX VALUE 'REPL'.
01 SSA001-GU-SE1PART. 02 SSA001-BEGIN PICTURE x(19) VALUE 'SE1PART(FE1PGPNR='. 02 SSA001-FE1PGPNR PICTURE X(8). 02 SS1001-END PICTURE X VALUE ')'. 01 SSA002-GN-SE1PPUR PICTURE X(9) VALUE SE1PPUR' 01 IOAREA PICTURE X(256).VALUE '.
MOVE PART-NUMBER TO SSA001-FE1PGPNR. CALL 'CBLTDLI' USING GHU-SSA002-GN-SE1PPUR.
The retrieved PURCHASE ORDER segment can now be changed by the program in the IOAREA.
CALL ‘CBLTDLI’ USING REPL
: segment is replaced with contents in the IOAREA
Other than BLANK is an error.