12.13 Generate Static Page Output to the IFS (Integrated File System)

The WEB_STATIC_PAGE Built-in Function allows you to output Static HTML Pages directly to the IFS (Integrated File System). When you use this Built-in Function, all DISPLAY / REQUEST statements in the RDML will be sent to the IFS. Using this BIF to produce static HTML Pages allows users to access the 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 - they will not be created. It is recommended that DEFAULT_SCRIPT, STDHEADER, STDFOOTER, MESSAGES and STYLESHEETS for the Process containing the Function be customized to be suitable for a static page, thus reducing the size of the generated 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 IBM's standard file SYS in library QSYSINC member ERRNO.

This Built-in Function can only be used in a Web-enabled process and can only be run in BATCH mode. This is possible because 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 a non-programmable terminal (NPT or 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 (e.g. Filename, Suffix, Full Output Path on the IFS and Code page used to generate the IFS File) that have been passed into the BIF. If no parameters are passed, default parameters will be used. Refer to WEB_STATIC_PAGE for more information.

In a multi-tier deployment, 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 non-programmable terminal in a multi-tier

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.

This example of the WEB_STATIC_PAGE BIF 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 Panel Id 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 his 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 is used as follows, the IFS File will be created in /DIRECTORY1/REPORT1/ 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''' '''/''')