4.1 TRANSFER Statements in WEBROUTINEs

In its simplest form, each WEBROUTINE in a WAM is associated with one XSL stylesheet, which defines the presentation layer, also known as the Web Design. Once a WEBROUTINE is invoked, only that WEBROUTINE's page will be returned. Sometimes, however, it is necessary to "redirect" execution to a different page from RDMLX. For example, a WEBROUTINE might be requested but the session has expired. In this case, it may be necessary to display an error page or a different page to the one requested.

Another example is a Logon page with a single logon button to invoke a Logon WEBROUTINE. This WEBROUTINE authenticates the user and depending on whether the user is a registered user or a guest, it would "redirect" to the appropriate WEBROUTINE and present the appropriate page. There are many other examples where it may be necessary to "redirect" from one WEBROUTINE to another.

This "redirection" can be accomplished with the use of a TRANSFER statement. The fields are mapped to the target WEBROUTINE according to that WEBROUTINE's WEB_MAP statements. Only fields and lists specified on the incoming WEB_MAPs are passed to the target WEBROUTINE.

The TRANSFER statement has the following properties:

Property

Description

TOROUTINE

Specify the name of a WEBROUTINE to transfer to. You can specify another WAM, in this case the WAM name followed by a WEBROUTINE name separated by a dot (e.g. #MYWAM.Browse).

A Service Name can also be specified, if prefixed with the *SERVICE modifier.

The value can also be provided from a field, if prefixed with the *EVALUATE modifier.

OnEntry

This property is used for mapping incoming fields and lists into the target WEBROUTINE. This property can be one of:

*MAP_NONE (does not map any fields or lists),

*MAP_ALL (maps all required fields and lists),

*MAP_LOCAL (only fields and lists on WEBROUTINE's WEB_MAPs are mapped),

*MAP_SHARED (only WAM level WEB_MAP fields and lists are mapped, not WEBROUTINE level).

The default value is *MAP_ALL.

 

 

When a TRANSFER is performed, the target WEBROUTINE assumes control of execution and the source WEBROUTINE does not regain control. When the target WEBROUTINE is exited, that WEBROUTINE's page is returned, as if the WEBROUTINE was invoked directly from the browser.

The following are some examples of TRANSFER statement:

TRANSFER TOROUTINE(Browser)
TRANSFER TOROUTINE(#MYWAM.Browser)
TRANSFER TOROUTINE(*SERVICE EmployeeBrowse)
change #WEBRTN 'wam1.routine1'
TRANSFER TOROUTINE(*EVALUATE #WEBRTN)