3 14 Saving a WAM s Output to a File

LANSA WAM

3.14 Saving a WAM's Output to a File

In addition to running a WAM from a web browser, you can also run a WAM from  the X_RUN command line to save the output to a stream file.

The syntax for the X_RUN command line for a Windows platform is:

Where:
the ending '\' for each line is added as a line continuation indicator to make the command line easier to read in this documentation. The above is meant to be a single command line to be submitted inside a command prompt.

Note: For IBM i and Linux, the actual command line required is slightly different but the X_RUN arguments required are much the same.

The following X_RUN arguments are essential to run a WAM and save the output to a stream file:

Argument

Value

PROC

"*WAMSP" is the special fixed value to activate this function.

WMOD

WAM name to be executed.

WRTN

WebRoutine name in the WAM to be executed.

WAML

Markup language to run the WAM in the WMOD argument. Optional. The default is LANSA:XHTML.

PART

Partition where the WAM in the WMOD argument, belongs.

LANG

Language for running the WAM in the WMOD argument,.

USER

User for running the WAM in the WMOD argument. Optional for some platforms.

WASP

Output file path where the WAM output will be saved. The path required follows the syntax of the platform where the WAM is executed.

For example, for Windows, you would enter: C:\Temp\wam_output.html (with backward slash characters). For IBM i, it is the IFS format and with Linux, uses forward slash characters.

 

Additional X_RUN arguments can be added. For example, ITRO, ITRM and ITRL can be used to enable tracing. Refer to the X_RUN Parameter Summary in the Visual LANSA Technical Reference for more information.

For example:

Where, for Windows:

the above command line executes WebRoutine myrtn of WAM mywam in partition DEM using the markup language LANSA:XHTML and saves the output html into  the stream file C:\Temp\myrtn.html.

For Linux, the equivalent command line would be:

Note that the x_run command is in lower case and the output file path is in the UNIX format.

For IBM i, the equivalent command line would be:

There are a few limitations when running a WAM in this manner:

  • As there is no interaction with a web browser, no posted data can be passed to the WAM. Similarly, any HTTP request-related information, such as HTTP cookies, are not available. What this means is that any WEB_MAP for input fields or lists for the WebRoutine will not be updated with values, so fields would retain their default values and any lists would be empty.
  • For IBM i, the output stream file will be created using the code page for the user profile used to submit the X_RUN command.
  • A WAM that creates an Active session will still create a WAM session but that session would not be available for use by any subsequent WAM.
  • A WAM that requires an Active session will get the Invalid Session event fired. For this and the reason above, WAM session management should be avoided for WAMs to be run in this manner.