Summary -

In this topic, we described about the below sections -

Segments on IMS database can be changed by using the replace call (REPL). While replacing any segment, the application must have first read and hold the segment for update (GHU, GHN, GHNP).

No qualification is allowed on a replace call. IMS replaces the segment which segment has been held with REPL call. IMS will use the information in the io-area to change the existing segment on the database and will use the segment length from the DBD.

The key field on a segment can never be changed with REPL or with any other call. To change the key, the program must add a new segment and delete the old one. The Replace (REPL) call is used to change the values of one or more fields in a segment which are not part of key.

			db pcb/aib 
        		i/o area 


  • Database Program Control Block
  • Specifies the DB PCB for the REPL 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 REPL 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 REPL 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 REPL call.

A REPL call must be followed by one of the three Get Hold calls (GHU, GHN & GHNP). After the segment retrieved, applications program needs to modify it in the I/O area and then issue a REPL call to replace it in the database.

IMS replaces the segment in the database with the segment information in the I/O area. REPL call can’t be changed the segment field lengths. The N command with REPL describes that IMS not to replace one or more of the multiple segments that were returned using the D command code.

Application program can specify an N command code even though there is a D command code or no D command code in preceding Get Hold call. A qualified SSA is required on a REPL call.

To use REPL call on particular segment, the segment must have been previously defined as replace-sensitive by PROCOPT=A or PROCOPT=R on the SENSEG statement in the PCB. If the segment not modified, the lock will be released automatically when the application program moves to another database record. Q command code need to be used if the segment needed for the exclusive use of application program.