CHANGES (return changed queue)

Top  Previous  Next

 

CHANGES( queue )

CHANGES

Returns a "hash" value for the QUEUE.

queue

The label of a QUEUE structure, or the label of a passed QUEUE parameter.

The CHANGES procedure returns a LONG integer containing a unique "hash" value for the current QUEUE contents. Saving this value then later comparing the saved value to the current return value from CHANGES allows you to easily detect that the contents of the QUEUE have changed (in any way at all).

Return Data Type:

LONG

Example:

SaveHash  LONG

Que       QUEUE

Name       STRING(10)

         END

CODE

Que.Name = 'Jones'

ADD(Que)                 !Add the entry

ASSERT(~ERRORCODE())

SaveHash = CHANGES(Que)  !Save the "hash" value of the entire QUEUE contents

Que.Name = 'Jones II'

ADD(Que)                 !Add another entry, changing the QUEUE contents

ASSERT(~ERRORCODE())

IF SaveHash <> CHANGES(Que) !This should be a true expression here

 MESSAGE('CHANGES procedure worked correctly')

END

See Also:

QUEUE