Functional map basics

A functional map is like a subroutine; it maps a portion of data at a time. It takes one or more input objects and generates one output object. For example, you might have a functional map that maps one Message to one row in a database table. Or you might have a functional map that maps one Header and one Detail to one ItemRecord.

The result of the functional map is sent directly to the output card when the type of the output card is:
  • A group
  • A partitioned item, when more than one of the partitioned type rsquos subtypes has a rule other than the =NONE rule. The functional map evaluates the rules in the order that they are specified, and when the result of a rule is not NONE, the functional map builds the output of that rule as the partition that the rule is on.

A functional map result that returns directly to the output card is not available to the calling map for use in subsequent operations.

When the output of a functional map is an item, you can use the ASFUNCTION general function to return the output of the functional map to the calling map instead of to the output card. The calling map can use the returned result in subsequent operations in the same map rule. With ASFUNCTION, the result of the functional map returns to the calling map rule when the type of the output card is:
  • A non-partitioned item type
  • A partitioned item, in one of the following conditions:
    • There is a rule on the partitioned item.
    • All of the subtypes for the partitioned type, except one, have the =NONE rule.

When you do not use ASFUNCTION to run a functional map, the item is sent directly to the output card.