ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

What happens when a file with duplicate keys is reorganized?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • What happens when a file with duplicate keys is reorganized?

    I have a file that is keyed by four fields. The file has duplicate keys and the sequence of the records is critical. If the file is reorganized, could the order of the records within a key value change?

  • #2
    Re: What happens when a file with duplicate keys is reorganized?

    Look at the help text on parameter KEYFILE. If you are just trying to remove deleted records I think *NONE would work but I would do some testing on it. The other values could change the order of the records.

    Comment


    • #3
      Re: What happens when a file with duplicate keys is reorganized?

      The first occurrence of the duplicate will be first, the second , second.

      a a b b 1
      a a b b 2

      Looking at the file before you reorg and after you reorg will not change the order of the dups. They are in the table now by key and rrn. Same after. One will not leap frog over the other. They might have different rrn's but the first will always be first.

      If this makes sense.
      Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

      Comment


      • #4
        Re: What happens when a file with duplicate keys is reorganized?

        Originally posted by taherte001
        If the file is reorganized, could the order of the records within a key value change?
        Yes, if you choose options that don't preserve the arrival sequence.

        In iSeries Navigator, drill into your database and schema to list Tables. Right-click the table and select Data-> Reorganize... and choose the 'By compressing out deleted rows' option along with 'Preserve arrival row sequence'.

        It'd be far better if the table didn't require a physical row sequence.
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment

        Working...
        X