REPLIMS CALL (Replace an IMS segment)

Figure 1. Syntax
(1)
Segment details

1 1SEGMENT=segname +  #
2.1 ? layout_ref.  field_ref=field_value4
2.1 ? + 5 qualifier .field_name=field_value
Notes:
  • 1 To use field_ref or field_name, you must have already loaded a view by preceding this function call with a call to VIEWIMS.
  • 2 Specification of a field_ref without qualification of a layout_ref results in the field_ref being associated with the current layout for the repsegm segment that is being replaced
  • 3 To fully qualify a field name, the layout name must be the first qualifier specified. If the layout name is not specified, FM/IMS searches the current the layout for the repsegm segment being replaced. If the group qualifiers and field name are not found, FM/IMS searches all the layouts for the repsegm segment in relative order until the group qualifiers and field name are found. If not found, an error message is displayed and processing terminates.
  • 4 Specification of a field_ref without qualification of a layout_ref results in the field_ref being associated with the first layout for the segname segment.
  • 5 To fully qualify a field name, the layout name must be the first qualifier specified. If the layout name is not specified, FM/IMS searches all the layouts for the segname segment in relative order until the group qualifiers and field name are found. If not found, an error message is displayed and processing terminates.
conkey
The concatenated key of the segment you want to update.
field_name
A field name.
field_ref
A field reference number of the field within the layout. This can be obtained by printing the view/template using the VIEWIMS DESCRIBE clause or browsing the view/template online.
field_value
The value of the field specified by field_ref or field_name.
FIRST
Replaces the first segment in the database that satisfies the WHERE clause.
layout_ref
The relative number of layout within segname segment. This can be obtained by printing the view/template using the VIEWIMS DESCRIBE clause.
NEXT
Replaces the next segment in the database after the current segment that satisfies the WHERE clause.
qualifier
One or more qualifiers that identify the field name (field_name). The first qualifier is the segment layout name. Subsequent qualifiers (if any) are the group fields used to identify the specified field name.
Omitting the layout name or group fields causes FM/IMS:
  • For the SET clause, to search the current repsegm segment layout for the specified qualifiers and field name. If not found, then all repsegm segment layouts are searched for the specified qualifiers and field name.
  • For the WHERE clause, to search all the segname segment layouts for the specified qualifiers and field name.
Note: The layout names and group fields can be obtained by printing the view/template using the VIEWIMS DESCRIBE clause or browsing the view/template online.
repsegm
The name of the segment you want to update.
segname
The name of a segment in the hierarchical path of the segment that you want to update.

Returns zero if successful, otherwise nonzero.

If FM/IMS encounters an unavailable HALDB partition or DEDB area, the REPLIMS function receives a return code of 8 and the ISPF variable FMSTATUS indicates an IMS status code of:

FH
an unavailable DEDB area
BA
an unavailable HALDB partition

To update the contents of the current segment, omit the WHERE clause. Otherwise, use the WHERE clause to identify the segment you want to update.

To replace the current contents of the segment with the contents of the OUTREC variable, omit the SET clause. If you are inserting a variable-length segment, then the first two bytes of OUTREC must specify the length of the segment.

Otherwise, use the SET clause to specify replacement field values for the segment.

When you use OUTREC, you replace the entire contents of the segment. When you use the SET clause, you can replace only the field values that you specify; other field values remain unchanged.

IEB example using REPLIMS

⋮
$$FILEM IEB
⋮
$$FILEM     PROC=*

filerc = VIEWIMS('TPLDSN=FMN.IMS.IVP.TEMPLATE')

filerc = GETIMS('SEGMENT=SUBURB  ',
               ' WHERE SEGMENT=SUBURB #SUBURB-NAME=CITY BEACH')

 /* Replace a segment using OUTREC */
         /* or */
OUTREC = OVERLAY('6168',outrec,19)
filerc = REPLIMS('SEGMENT=SUBURB')
         /* or */
 /* Replace a segment using SET */

rtrc=REPLIMS('SEGMENT=SUBURB ',
             'SET #POST-CODE=6168',
            ' WHERE SEGMENT=SUBURB #SUBURB-NAME=CITY BEACH')
/+
⋮