Net.Data provides a large set of built-in functions to simplify Web page development. These functions are already defined by Net.Data, so you do not need to define them. You can call these functions as you would call other functions.
Figure 23 shows how the Net.Data built-in functions and the macro interact.
Figure 23. Net.Data Built-in Functions
![]() |
Built-in functions can return their results in three ways, depending on its prefix:
Some built-in functions do not have each type. To determine which type a particular built-in function has, see the Net.Data built-in functions chapter in Net.Data Reference.
The following sections provide a high-level overview of the Net.Data built-in functions. Use these functions to perform general purpose, math, string, word, or table manipulation functions. See Net.Data Reference for descriptions of each function with syntax and examples. Some of these functions require variables to be set prior to their use, or must be used in a specific context. Not all operating systems support each built-in function. See Net.Data Reference to determine which functions are supported for your operating system.
This set of functions help you develop Web pages by altering data or accessing system services. You can use them to send mail, process HTTP cookies, generate HTML escape codes, and get other useful information from the system.
For example, to specify that Net.Data should exit a macro if a specific condition occurs, without processing the rest of the macro, you use the DTW_EXIT function:
%HTML(cache_example) { <html> <head> <title>This is the page title</title> </head> <body> <center> <h3>This is the Main Heading</h3> <!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!> <! Joe Smith sees a very short page !> <!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!> %IF (customer == "Joe Smith") </body> </html> @DTW_EXIT() %ENDIF ... </body> </html> %}
Another useful function is the DTW_URLESCSEQ function, which replaces characters that are not allowed in a URL with their escape values. For example, if the input variable string1 equals "Guys & Dolls", DTW_URLESCSEQ assigns the output variable to the value "Guys%20%26%20Dolls".
These functions perform mathematical operations, letting you calculate or alter numeric data. Besides standard mathematical operations, you can also perform modulus division, specify a result precision, and use scientific notation.
For example, the function DTW_POWER raises the value of its first parameter to the power of its second parameter and returns the result, as shown in the following example:
@DTW_POWER("2", "-3", result)
DTW_POWER returns ".125" in the variable result
These functions let you manipulate characters within strings. You can change a string's case, insert or delete characters, assign a string value to another variable, plus other useful functions.
For example, you can use DTW_ASSIGN to assign the value of an input variable to an output variable. You can also use this function to change a variable in a macro. In the following example, the variable RC is assigned to zero.
@DTW_ASSIGN(RC, "0")
Other string functions include DTW_CONCAT, which concatenates strings, and DTW_INSERT, which inserts strings at a specific position, as well many other string manipulations functions.
These functions let you manipulate words in character strings. Most of these functions work similar to string functions, but on entire words. For example, they let you count the number of words in a string, remove words, search a string for a word.
For example, use DTW_DELW0RD to delete a specified number of words from a string:
@DTW_DELWORD("Now is the time", "2", "2", result)
DTW_DELWORD returns the string "Now time".
Other word functions include DTW_WORDLENGTH, which returns the number of characters in a word, and DTW_WORDPOS, which returns the position of a word within a string.
You can use these functions to generate reports or forms using the data in a Net.Data table variable. You can also use these functions to create Net.Data tables, and to manipulate and retrieve values in those tables. Table variables contain a set of values and their associated column names. They provide a convenient way to pass groups of values to a function.
For example, DTW_TB_APPENDROW appends a row to the table. In the following example, Net.Data appends ten rows to the table, myTable:
@DTW_TB_APPENDROW(myTable, "10")
Additionally, DTW_TB_DUMPH, returns the contents of a macro table variable, enclosed in <pre></pre> tags, with each row of the table is displayed on a different line. And DTW_TB_CHECKBOX returns one or more HTML check box input tags from a macro table variable.
Use the flat file interface (FFI) functions to open, read, and manipulate data from flat file sources (text files), as well as store data in flat files.
For example, DTWF_APPEND, writes the contents of a table variable to the end of a file, and DTWF_DELETE deletes records from a file.
Additionally, the FFI functions allow file locking with DTWF_CLOSE and DTWF_OPEN. DTWF_OPEN locks a file that so that another request cannot read or update the file. DTWF_CLOSE releases the file when Net.Data is done with it, allowing other requests to access the file.
Use the Web registry functions to maintain registries and the entries they contain. A Web registry is a file with a key maintained by Net.Data to allow you to add, retrieve, and delete entries easily.
For example, DTWR_ADDENTRY adds entries, while DTWR_DELENTRY deletes entries. DTWR_LISTSUB returns information about the registry entries in an OUT table parameter, and DTWR_UPDATEENTRY replaces the existing values for a specified registry entry with a new value.