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:

X_RUN PROC=*WAMSP \

      WMOD=(wam_name)

      WRTN=(web_routine_name) \

      WAML=(markup_language) \

      PART=(partition) \

      LANG=(language) \

      USER=(user) \

      WASP=(output_file_path) \

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:

X_RUN PROC=*WAMSP WMOD=mywam WRTN=mtrtn WAML=LANSA:XHTML \

      PART=DEM LANG=*DFT USER=PCXUSER WASP=C:\Temp\myrtn.html

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:

x_run PROC=*WAMSP WMOD=mywam WRTN=mtrtn WAML=LANSA:XHTML \

      PART=DEM LANG=*DFT USER=PCXUSER WASP=/tmp/myrtn.html

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

For IBM i, the equivalent command line would be:

Call x_run ('PROC=*WAMSP WMOD=mywam WRTN=mtrtn WAML=LANSA:XHTML

PART=DEM LANG=ENG WASP=/tmp/myrtn.html')

 

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