7.54 EXCHANGE

Note: Usage options

The EXCHANGE command allows information to be exchanged between functions via an internal LANSA queue called the "exchange list".

The "exchange list" is like a notice board that can be used to exchange information between functions. It is not the same as the parameter list concept that has been traditionally used to exchange information between programs.

When a function executes an EXCHANGE command (or uses an EXCHANGE parameter) it is in effect "tacking" information onto the notice board. This information is left on the notice board until another function is invoked.

When another function is invoked the first thing it does is to look at the entries on the notice board. If any of the entries "apply" to the function they are copied from the notice board into the function.

The notice board is then cleared. It is important to remember this step is always performed.

Note that an EXCHANGE command in a Component is only valid for passing information to and from a Function. For example, using the CALL or SUBMIT command. It is not valid to receive information into a Component this way. Unpredictable results will occur. (an example is that the instantiation of a Component does not clear the exchange list) The recommended way to pass information into and out of a Component is to use a method call or get a property or set a property.

Remember that there are many ways of invoking a function. These include being selected from the process main menu, by executing a TRANSFER command, a CALL command, a SUBMIT command or by using the PROMPT function key.

Also See

7.54.1 EXCHANGE Parameters

7.54.2 EXCHANGE Comments / Warnings

7.54.3 EXCHANGE Accessing the Exchange List from RPG/COBOL

7.54.4 EXCHANGE Examples

                                                         Optional 

 

  EXCHANGE ----- FIELDS ------- field name --------------------->

                           | expandable group expression |

                           |                             |

                            --------- 100 max -----------

 

                 OPTION ------- *NOW ---------------------------|

                                *ALWAYS