GENML, SGENML
GENML generates an English listing in the same way as LIST. However, the result is embedded in a web page template specified by the user and saved to a file item.
SGENML is similar, but its output is in item-id order unless sort criteria specify otherwise.
Syntax
GENML
SGENML
Refer to Sentence Structure for descriptions of these parameters.
Options
F Defines items as described below.
P Sends the listing to the printer. You will not be prompted for an output file or item.
T Sends the output to the terminal. You will not be prompted for an output file or item.
X Requests the output type for the results. This can be HTML (the default if none is given), JSON or XML.
If the X option is specified, the following prompt is displayed:
Conversion Type:
The valid responses are HTML, JSON, or XML. If you simply press RETURN, the default of HTML is used. If an invalid type is given, the message, Item not on file error is displayed and the type is requested again.
Operation
When executed, the GENML and SGENML commands prompt for an optional format type (see option X), the file and item into which to save the generated results, and for the file and item containing the template into which the Reality data will be embedded. For example:
:
GENML EMP ID-SUPP TITLE EMPNO WITH EMPNO = "02]"Template file name or <RETURN> for default:
HTMLTemplate item name:
EMPTEMPLATEOutput file name:
MYDIRVIEWOutput item name:
emp.htm
This selects data from the file EMP and outputs the attributes identified by TITLE and EMPNO, suppressing the item-id (the TITLE and EMPNO data definition items use the XT conversion code). The output is embedded in the template item EMPTEMPLATE in the file HTML and saved in item emp.htm in the file MYDIRVIEW.
Note that if you press RETURN at the Template file name
prompt, you are not prompted for a template item. Instead, a simple default
template is used.
The P and T options respectively send the generated output to the printer and terminal. If you specify either of these options, you are not prompted for an output file or item.
The F option uses a template item containing placeholders that will be replaced by the relevant values in the columns from the data. Each row of data will create an item in the specified file or if the output is to the screen or printer, a continuous listing. This overrides the X option and the supply of a template file and item is mandatory. This allows the user more detailed formatting of the generated data.
The template item uses placeholders to indicate where values from a row of data will appear. The placeholders are formatted as <%n%> where n is the number of the column to show the value from. For example, if a row of data consists of 123 VM ABC VM 456 and the template contains <%3%>~<%2%>~<%1%>, the resulting data will be 456~ABC~123. Any placeholders that are greater than the maximum number of columns in the data will not be changed.
If the output is to a file, the requested output item id will be used to create unique item ids in the file. The entered value will generate an id consisting of the value from the first column of a row of data suffixed with a dot then the entered id. For example, if the value in the first column contains 123 and the entered id is ABC then the resulting id of 123.ABC will be generated. A supplied id containing an asterisk signifies the position of the first columns value in the generated id. For example, an entered id of ABC-*-DEF would result in an id of ABC-123-DEF being used. The asterisk can be used any number of times and each occurrence will be replaced with the first columns value.
Comments
Refer to HTML from English for details of how to write an HTML template and use the XT conversion code.
The specified files and template must exist - if they cannot be found, an error message is displayed and no output is produced.