Load HTML from a Source Member

cgiLoadHtml

The cgiLoadHtml procedures loads an HTML document into an internal work buffer and readies it for processing.

The cgiLoadHtml procedure loads HTML from a source file member into an internal work buffer and readies it for processing by the cgiSetHtmlVar and cgiWrtSection procedures.

section-count  cgiLoadHtml(
 szSrcFileLib          21A    Const 
 szSrcMbr              10A    Const 
 bReplace                N    Const OPTIONS(*NOPASS)
)

See also: cgiLoadHtmlIFS, cgiWrtSection, cgiSetHtmlProp cgiSetHtmlVar cgiInit

Parameters

szSrcFileLib
[input Char(21) const]  The qualified source file and library where the szSrcMbr exists. This parameter consists of two parts (1) in the first 10 positions, the name of the source file, and (2) in the second 10 positions, the name of the library in which the source file is located. For example:
 *...v....1....v....2
'MYHTML    QTEMP     '
 

An alternative syntax is also supported for the szSrcFileLib parameter. The alternate syntax allows you to specify the source file name in qualified syntax. This is similar to that of an OS/400 CL command. The source file may be qualified using qualified name syntax, as follows:

 *...v....1....v....2
'QGPL/QHTMLSRC       '
 
szSrcMbr
[input Char(10) const]  The name of the source member that contains the HTML to be loaded.
 
bReplace  [ optional ] DFT(*OFF)
[input Indy const]  Replace the internal HTML work buffer before loading the new HTML file. If *OFF is specified for this parameter or the parameter is not specified, the HTML file being loaded is added to the end of the existing work buffer. This allows you to load multiple HTML files into a single work buffer and treat them as one entity. Note that a call to the cgiInit() always clears the internal work buffer so the setting of this parameter has no influence during the first call to cgiLoadHtml().

Return Value

If the function succeeds, the return value is the number of CGILIB Sections that were loaded. If the function fails, 0 is returned and a message is written to the joblog.

Remarks

Call cgiLoadHtml to load HTML from a source file member. Specify a qualified source file name or an unqualified source file name and a source member name. To load HTML from the IFS, use the cgiLoadHtmlIFS() procedure.

Example

      /INCLUDE XTOOLS/QCPYSRC,CGI
 
.....DName+++++++++++EUDS.......Length+TDc.Functions+++++++++++++++++++++++++
     D CONTACT         S             20A
     D CMPNAME         S             30A  
     D PHONE           S             11P 0
     D szSrcMbr        S             10A   Inz('ORDERFORM')
 
.....C..n01..............OpCode(ex)Extended-factor2++++++++++++++++++++++++++++
     C                   callp     cgiInit()
     C                   eval      CONTACT = cgiGetVar('CONTACT')
     C                   eval      CMPNAME = cgiGetVar('COMPANY')
     C                   eval      PHONE   = cgiGetVarI('PHONE')
     C                   if        cgiLoadHtml('CGILIB/QHTMLSRC':szSrcMbr) <= 0
     C                   callp     wrtjoblog('Could not load HTML mbr %s.':szSrcMbr)   
     C                   endif