HTML output is enabled with the ODS HTML statement. The
ODS HTML statement can create
-
an HTML file (called the body file)
that contains the results from the procedures run in your Application
Dispatcher program
-
a table of contents that links
to the body file
-
a table of pages that links to
the body file
-
a frameset that displays the table
of contents, the table of pages, and the body file.
ODS might also generate
additional HTML or image files if you split the output across multiple
body pages or you use embedded GIF or JPEG images to display graphics.
The HTTP protocol used by the Application Dispatcher can deliver
only one output file back to the Web browser per request. This output
file is written to the _WEBOUT fileref. Because ODS generates multiple
output files in many cases, the extra files must be stored in a temporary
location and retrieved by the Web browser in subsequent requests.
The Application Server automatically creates a unique temporary catalog
for every request for this purpose. The two-level catalog name is
defined in the special macro variable _TMPCAT. ODS must also put hyperlinks
and inline image links into the HTML that it generates that retrieves
the files from the temporary catalog. The special macro variable _REPLAY
contains the base URL used to create these links.
To enable the above
features, any Application Dispatcher program that uses ODS to generate
HTML should include the following options in the ODS HTML statement:
ods html path=&_tmpcat (url=&_replay) rs=none ...;
Note: The RS=none option forces ODS to perform record based
output and is required when writing to the _WEBOUT fileref or to a
catalog entry.
ODS is capable of creating
a number of different layouts for your output. All layouts have one
thing in common: the "primary" page must be returned directly to your
Web browser (via the _WEBOUT fileref). The page written to the _WEBOUT
fileref must be preceded by an HTTP header with the appropriate content-type
field.
Starting with Release 8.2, the automatic
HTTP header generation feature recognizes some ODS output types and
generates appropriate content-type headers. Supported output types
include HTML, GIF, and JPEG. An appropriate content type must be manually
set with
APPSRV_HEADER function for all other output types.
If you are writing to _WEBOUT using
PUT statements while ODS has _WEBOUT open, when you execute the code
the PUT statement data might be out of sequence with the data generated
by ODS. This problem occurs because both your code and ODS are opening
the same fileref at the same time. This problem can be fixed by inserting
your PUT statements before you open ODS, closing ODS while you write
directly to the fileref, or using the
ODS HTML TEXT="string"
option to write data. The following code is an example of how you
can use the ODS HTML TEXT="string" option to write data:
ods listing close;
ods html body=_webout path=&_tmpcat
(url=&_replay) Style=Banker;
... other code ...
ods html text='<p align="center"> </p>' ;
ods html text='<p align="center"><b>Test.
If you see this in order, it worked.</b></p>';
... other code ...
ods html close;