Static page output to the IFS (Integrated File System)

Date:Archived
Product/Release:LANSA for the Web
Abstract:LANSA for the Web allows the generation of Static HTML Pages directly on to the IFS (Integrated File System)
Submitted By:LANSA Technical Support

LANSA for the Web allows the generation of Static HTML Pages directly on to the IFS (Integrated File System). A new WEB_STATIC_PAGE Built-in Function allows the output of Static HTML to the IFS (Integrated File System). When this Built-in Function used – all DISPLAY / REQUEST statements in the RDML will be sent to the IFS. Using this BIF to produce static HTML Pages allows users access to Static HTML rather than dynamically generating the page each time a function is run from the Browser. Static Pages can also be served up quicker than running a LANSA function each time a user request is made from the Browser.

This Built-in Function can only be used in a Web-enabled process. When using this BIF, the LANSA System owner or object owner must have sufficient authority to create, delete and write to a file in the specified directory or Default Path on the IFS. It is recommended that DEFAULT_SCRIPT, STDHEADER, STDFOOTER, MESSAGES and STYLESHEETS for the Process containing the Function be customized suitable for a static page – reducing the size of the generating HTML Page. A status message indicating the success or failure will be issued. Error Codes and Descriptions in the status message can be found in the IBM® standard file SYS in library QSYSINC member ERRNO.

This Built-in Function can only be used in a Web-enabled process. Functions can be run in BATCH to produce static HTML Pages on the IFS. This is possible, as there is no screen interaction when using this BIF.

LANSA Functions that make use of the WEB_STATIC_PAGE BIF can be executed via the Web Browser or the Green-Screen. When the BIF is used and the function is run from the Browser, all HTML will be sent to the IFS based on the parameters that have been passed into the BIF. If no parameters are passed, Default parameters will be used. Refer to the LANSA Built-in Functions Guide for more information on BIF parameters. In a multi-tier (Model B) setup, IFS output will be sent to the Web server (front-end) only when the function is executed from the Browser. If the Function is executed from a Green-screen in a Model B scenario, IFS output will be sent to the Data Server (the back-end). Functions using this BIF can also be submitted to run in Batch to generate or update static HTML Pages.

In MODEL B setup, IFS Pages are sent to the Web Server when the Function is run from the Browser. Static Pages are sent to the back-end Data Application Server when the Function is executed from the green-screen or BATCH.

Refer to LANSA Built-in Functions Guide for more information on BIF Parameters.

The WEB_STATIC_PAGE BIF allows the specification of a Filename, Suffix, Full Output Path on the IFS and Code page used to generate the IFS File - Default parameters will be used if they are not specified. Directories must exist on the IFS with appropriate authorities - they will not be created. The following example illustrates the use of the WEB_STATIC_PAGE BIF:

The following example will output Employee Details to a static page on the IFS. Default Parameters will create the IFS File with the Process/Function Name as the Default Filename and PanelID as the Default Suffix in the root directory of the IFS.(/).

FUNCTION OPTIONS(*DIRECT)

GROUP_BY NAME(#FLDLST) FIELDS((#EMPNO) (#SURNAME) (#GIVENAME) (#ADDRESS1) (#ADDRESS2) (#POSTCODE) (#PHONE) (#FAX))
* The WEB_STATIC_PAGE BIF used here will 
* send all DISPLAY/REQUEST statements to the -
* IFS. It will be setup with Default Parameters. -
USE BUILTIN(WEB_STATIC_PAGE)
* Fetch Employee Details from Employee File 
* for the Employee No exchanged to this 
* function-
FETCH FIELDS((*ALL )) FROM_FILE(PSLMST) WITH_KEY(A1234)
* If Employee exists, output to IFS else send MESSAGE-
IF_STATUS IS_NOT(*OKAY)
MESSAGE MSGTXT("Employee not Found in PSLMST File')
ENDIF
* Output Display to IFS-
DISPLAY FIELDS((#FLDLST))

When the WEB_STATIC_PAGE BIF is used, various parameters can be used to setup the output path, filename and suffix parameters.

If the BIF was used as follows, the IFS File will be created in /WWWSERV/WEBDOCS/ with filename IFSFILE.htm.

USE BUILTIN WEB_STATIC_PAGE WITH_ARGS('''IFSFILE''' '''*NO''' '''/DIRECTORY1/REPORT1/''')

If the BIF was setup as follows, the IFS File will be created in the root directory (/) with filename IFSFILE001.htm – the Default Suffix is the PanelID.

USE BUILTIN WEB_STATIC_PAGE WITH_ARGS('''IFSFILE''' '''*DFT''' '''/DIRECTROY1/REPORT1/''')

The WEB_STATIC_PAGE BIF can only be used in Web-enabled Process. Refer to LANSA Built-in Functions Guide for more information on BIF Parameters.