RUN

The RUN function allows you to execute another compiled map from a component or map rule.

You can use RUN to dynamically name source or destination files, or both, or to dynamically pass data to a map. You can also use the RUN function to split the output data into separate files based on some value in the input.

Syntax:
RUN (single-text-expression [ , single-text-expression ])
Meaning:
RUN (map_to_run [ , command_option_list ])
Returns:
A single text item

The first argument, map_to_run, is an expression identifying the name of the compiled map (.mmc) to be run.

The command_option_list argument is an optional argument that you can use to specify execution commands applicable to the map to be run. Command_option_list is a text item containing a series of execution commands separated by a space. Any execution command can be used as part of the command_option_list argument. For example, you can send data to another map by using the echo command option (-IEx).

See the Execution Commands documentation for a list of command options.

The result of the RUN function depends on the command options in command_option_list.

Echo command option

  • If you use the Echo command option for an output card, the data from that card will be passed back as a text item to the object in the map from which it was run.
  • If you use the Echo command option for more than one output card, the data from all echoed cards will be concatenated together and passed back as a text-item to the object in the map from which it was run.
  • If you do not use the Echo command option, the return code indicating the status of the map that was run will be passed back to the object in the map from which it was run.

Examples

  • RUN ("MyMap" , "-IE1s502 " + Invoice:File + " -OF1 install_dir\" + CustomerID:Invoice)

    This example runs the MyMap map, sending 502-byte fixed-size Invoice data as the data source for input card 1, overriding the filename of output card 1 based on Customer data and returns the map return code as the result.

  • RUN ( "GetDbOpt" , " " )

    This example runs the GetDbOpt map (with no command options specified) and returns the map return code as the result.

  • RUN ( "DoOneSet" , "-A -GR" + ECHOIN( 1 , Set:InFile ) ) + " -OF1 OUT_SET." + NUMBERTOTEXT ( INDEX ( $ ) ) + " -OE2" )

    This example runs the DoOneSet map. Command options include the following choices:

    • "-A -GR"

      The DoOneSet map will produce no Audit Log and restrictions will be ignored.

    • ECHOIN( 1 , Set:InFile )

      The ECHOIN function creates the -IE command option for echoing the data represented by Set:InFile to input 1 of the RUN map.

    • " -OF1 OUT_SET." + NUMBERTOTEXT ( INDEX ( $ ) )

      The output file for card 1 of the DoOneSet map will be called "OUT_SET." plus a sequence number based on the index of the Set in InFile. For example, the first output set will be OUT_SET.1, and so forth.

    • " -OE2"

      Using the output echo command option, the data built for output card 2 of the DoOneSet map will be returned as the result of the RUN function.

      An alternative to using the ECHOIN function shown above is using the long version. For example, replace ECHOIN( 1 , Set:InFile ) with:

      " -IE1S" + NUMBERTOTEXT ( SIZE ( Set:InFile ) + " " + TEXT ( Set:InFile )

      Using the Echo input command option (-IE) with the sizing method (Sn) or the ECHOIN function, one Set object of InFile is passed to input card 1 for the DoOneSet map.

Related functions

  • DDEQUERY