Using the Function Routing Table in LANSA for Windows!

Date: Archived
Product/Release: LANSA for Windows
Abstract: Use the function routing table on the PC to route a function call to actually calling a function on the AS/400
Submitted By: LANSA Technical Support

The Function Routing table allows the automatic (re)routing of invocations of a function to another function at execution time without changing a programs.

For more details on what the Function Routing Table is and how it works take a look at the following tips :

So how is function routing used with LANSA for Windows?

Apart from the "normal" use where a package provider has made some customizations, there is another use.

When using LANSA for Windows it is possible to execute an application on the PC using the data on the AS/400. This is called a Client/Server application, i.e. the application is running on the PC (Client) and the data (and validation/triggers) is on the AS/400 (Server). There is a piece in the middle (often called middleware) which reroutes your data requests to the AS/400 without changing your application. In LANSA for Windows this middleware is called LANSA/SuperServer. So, an application can use data from either the AS/400 or PC or from both at the same time!

The Function Routing table performs a similar rerouting role for functions.

Suppose a LANSA function was written as a generic report writer for the AS/400. The objective is to use this function from a LANSA for Windows application so that the reporting occurs on the AS/400 rather than on the PC, because of the amount of data that is required. How is this done?

To set the scene…

  • On the PC

    There is a LANSA function ABC0001 that calls a reporting function REP000 (that may not even exist on the PC).
  • On the AS/400

    The generic report writer function REP000 exists.

What to do…

  • On the PC

     A new LANSA function REP000X is written that has the following code:
			            WITH_ARGS(AS400 REP000) 
			   and put the following entry in the function routing  table:

Note: It may be necessary to exchange some information to the server function such as selection criteria for the report.

  • On the AS/400


So what happens…

The function ABC0001 calls REP000 but the function routing table routes this to REP000X. REP000x in turn calls REP000 on the AS/400.