Scope of Compose Extended Entity Reference.
The scope of the extended_entity_ref_id of the extended entity reference that defines a compose entity in the head of a COMPOSE declaration, is the actual COMPOSE declaration itself. That is, the extended_entity_ref_id can be accessed from any construct in the compose body, and in the WHEN clause of the actual COMPOSE declaration. It is legal to define another variable with the same name in an inner scope. This should be avoided as it can lead to erroneous mapping schemata, and mapping schemata that is difficult to read and understand.
The value of the extended_entity_ref_id is the current instance of the compose entity type in the iteration process.
Example of a COMPOSE declaration.
COMPOSE compose_example1 FOR t:target::targetEntity;
FROM (s:source::sourceEntity) – FROM is optional
WHEN (t.tag = s.identifier);
BEGIN_COMPOSE
 t.id_code := s.identifier.id_code;
 . . .
END_COMPOSE;