Mapping of enumerated values


Similar enum types in source and target are not compatible. I.e. is not legal to assign source enum values to target enum values.
It is recommended to make a function, as demonstrated below:
SCHEMA source;
TYPE colour = ENUMERATION OF (red,green,blue);
END_TYPE;
END_SCHEMA;
SCHEMA target;
TYPE colour = ENUMERATION OF (red,green,blue);
END_TYPE;
END_SCHEMA;
SCHEMA_MAP mapp;
.
.

  • --ti being a target instance and si being a source instance,
  • – both having an attribute of type COLOUR.
  • ti.colour = mapColour(si.colour);
  • .

FUNCTION mapColour(aColour : src::colour) : tar::colour;
CASE aColour OF
src::colour.RED : RETURN(tar::colour.RED);
src::colour.GREEN: RETURN(tar::colour.GREEN);
src::colour.BLUE : RETURN(tar::colour.BLUE);
END_CASE;
END_FUNCTION;
END_SCHEMA_MAP;