Repeating segments

You can create copies of segments by repeating segments. Repeating allows you to quickly duplicate a segment, and then easily change the unique data.

To repeat segments:

  1. Position your cursor in the prefix area of the segment that you wish to repeat.
  2. Type the R prefix command and press Enter.
  3. The Insert Segment panel is displayed, showing the copy of the selected segment.
  4. Unless the segment is set to accept non-unique records, you must change at least the Key value field in the new segment.
  5. Enter the required data.
  6. Press the Exit function key (F3) to insert the segment and return to the IMS Data panel.

As well as repeating a single segment, you can repeat entire segment hierarchies, by creating a copy of a parent segment and all of its children.

To repeat a segment and all of its child segments:

  1. Position your cursor in the prefix area of the parent segment that you wish to repeat.
  2. Type the RA prefix command and press Enter.
  3. The Insert Segment panel is displayed, showing the copy of the selected parent segment.
  4. Unless the segment is set to accept non-unique records, you must change at least the Key value field in the new segment.
  5. Enter the required data.
  6. Press the Exit function key (F3) to insert the segment and return to the IMS Data panel.
  7. Locate your new parent segment (see Notes below if you are having difficulty finding your new segment). Your new parent segment will have copies of all the children of the original parent segment, with each child linked to the new parent by the Key value field.
  8. If necessary, change values in the child segments.
Note:
  1. New segments are sorted into the appropriate key order for that segment type. If the key for this segment causes the segment to be sorted to a position prior to the database starting position, you may have to exit to the Database Positioning panel and change the Key values for any segments in that segment's database hierarchy.
  2. The inserted segments are not committed to the database until a SAVE command is issued on the IMS Data or Database Positioning panel, or until you EXIT from the Database Positioning panel, or until the next automatic checkpoint is issued (if AUTOSAVE has been turned on).

Related topics