# Synopsis

PDX_MSGT mda_TraverseModel(long option, int model, MDA_MDL_TRAVERSE *func)

# Purpose

Invoke a function against each entity in a model.

# Description

The function func will be invoked for each entity in the specified model. The traversal can be performed either forwards or backwards. Note that once entites have been deleted and added to the model, the direction of traversal is somewhat meaningless because of hole filling. The function passed in func must be declared as:

.RS 3 PDX_MSGT foo (MDA_PTR db_ptr) .RE

The function should return a value of MDA_NOERR (or PDX_NOERR) to indicate that the traversal should continue. If the value MDA_STOP_TRAVERSE is returned, the traversal will be stopped and mda_TraverseModel will return MDA_STOP_TRAVERSE as its error return.

Entities may be created by the called function, however, new entities may or may not be passed to the function later in the traverse.

# Input

## option

### MDA_LTOF

Traverse model in reverse order of the entity directory. If not specified, the default is to traverse it from first to last (i.e. the order the model was created in assuming no deletes were done).

## model

The model number to be traversed

## func

The function to be invoked for each entity

# Return

MDA error code