IBM Books

Reference


Net.Data Macro Syntax

A Net.Data macro is a text file consisting of a series of Net.Data macro language constructs that:

Each statement is composed of one or more language constructs, which in turn are composed of keywords, special characters, strings, names, and variables. The following diagram depicts the global structure of a syntactically valid Net.Data macro. See Macro Language Constructs for detailed syntax of each element in the global structure.



   .-----------------------------.
   V                             |
>>----+-----------------------+--+-----html block--------------->
      +-comment block---------+
      +-define statement------+
      +-define block----------+
      +-function block--------+
      +-macro if block--------+
      +-macro_function block--+
      +-include statement-----+
      +-include_url statement-+
      '-message block---------'
 
      .----------------------------------------------.
      V                                              |
>--------+-----------------------+---+------------+--+---------><
         +-comment block---------+   '-html block-'
         +-define statement------+
         +-define block----------+
         +-function block--------+
         +-macro if block--------+
         +-macro_function block--+
         +-include statement-----+
         +-include_url statement-+
         '-message block---------'
 

The Net.Data macro contains two parts: the declaration part and the presentation part. You can use these parts multiple times and in any order.

Figure 1 shows the declaration and presentation parts of the macro.

Figure 1. Macro Structure



Figure dtwa1107 not displayed.

Variables and functions that are used in the declaration or presentation part must be defined before being used by a variable reference or a function call.

Figure 2 demonstrates the parts of a macro. The declaration part contains the DEFINE and FUNCTION definition blocks. The HTML blocks act as input and output blocks.

Figure 2. The Macro Template Format


%{ **********************       Define block        ************************%}
%DEFINE {
   page_title="Net.Data macro Template"
%}
 
%{ ********************** Function Definition block ************************%}
%FUNCTION(DTW_REXX) rexx1 (IN input) returns(result)
    { %EXEC{ompsamp.cmd %}
%}
 
%FUNCTION(DTW_REXX) today () RETURNS(result)
  {
      result = date()
%}
 
%{ **********************      HTML Block: Input    ************************%}
%HTML (INPUT) {
<html>
<head>
<title>$(page_title)<title>
</head><body>
<h1>Input Form</h1>
Today is @today()
 
<FORM  METHOD="post" ACTION="output">
Type some data to pass to a REXX program:
<INPUT NAME="input_data" TYPE="text" SIZE="30">
<p>
<INPUT TYPE="submit" VALUE="Enter">
 
<hr>
<p>[<a href="/">Home page]
</body></html>
%}
 
%{ **********************    HTML Block: Output     ************************%}
%HTML (OUTPUT) {
<html>
<head>
<title>$(page_title)</title>
</head><body>
<h1>Output Page</h1>
<p>@rexx1(input_data)
<p><hr>
<p>[<a href="/">Home page</a> |
<a href="input">Previous page</a>]
</body></html>
%}
 

The Net.Data macro language is a free-form language, giving you flexibility for writing your macros. Unless specifically noted, extra white space characters are ignored. Each of the Net.Data macro language constructs is described in the following section, along with several other elements that are used to define the constructs. The Net.Data macro language supports DB2 WWW Connection language elements for backward compatibility. Although these language elements are described in Appendix B, DB2 WWW Connection, it is recommended that you use the Net.Data language constructs.

The examples show some of the ways you can use the language constructs, variables, functions, and other elements in your macros. You can download the samples and demos from the Net.Data Web pages for more extensive examples:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]