IBM Books

Reference


Net.Data Miscellaneous Variables

These variables are Net.Data-defined variables that you can use to affect Net.Data processing, find out the status of a function call, and obtain information about the result set of a database query, as well as determine information about file locations and dates. You might find these variables useful in functions you write or use them when testing your Net.Data macros.

DTW_CURRENT_FILENAME


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

The name and extension of the current input file. The input file is either a Net.Data macro or a file specified in an INCLUDE statement.

This variable is a predefined variable and its value cannot be modified. Use the variable as a variable reference.

Examples

<P>This file is <I>$(DTW_CURRENT_FILENAME)</I>,
and was updated on $(DTW_CURRENT_LAST_MODIFIED).

DTW_CURRENT_LAST_MODIFIED


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

The date and time the current file was last modified. The current file can be a Net.Data macro or a file specified in an INCLUDE statement. The output format is determined by the system on which Net.Data runs.

This variable is a predefined variable and its value cannot be modified. Use the variable as a variable reference.

Examples

<P>This file is <I>$(DTW_CURRENT_FILENAME)</I>,
and was updated on $(DTW_CURRENT_LAST_MODIFIED).

DTW_DEFAULT_MESSAGE


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X
X X X X

Purpose

Contains the message text returned from a call to a built-in function or to language environment when an error occurs.

You can use the DTW_DEFAULT_MESSAGE variable in any part of the Net.Data macro.

This variable is a predefined variable, it is not recommended to modify its value. Use the variable as a variable reference.

Examples

Example 1: A message stating whether the function completed successfully

@function1()
%IF ("$(RETURN_CODE)" == "0")
 The function completed successfully.
%ELSE
The function failed with the return code $(RETURN_CODE).  The error message
   returned is "$(DTW_DEFAULT_MESSAGE)".
%ENDIF

Example 2: The default text for when a function returns a non-zero return code

%MESSAGE{
default: {<h2>Net.Data received return code: $(RETURN_CODE). 
Error message is $(DTW_DEFAULT_MESSAGE)</h2> %} : continue
%}

The user sees the default error message, if a function returns a return code other than 0.

DTW_LOG_LEVEL


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X

X X X

Purpose

The level of messages that Net.Data writes to the log file.

You can specify the value of this variable using a DEFINE statement or with the @DTW_ASSIGN() function.

Requirement: Define DTW_LOG_DIR in the Net.Data initialization file to initiate logging; otherwise Net.Data does not log messages when you specify the DTW_LOG_LEVEL variable in the macro.

Values

DTW_LOG_LEVEL="OFF|ERROR|WARNING"

Table 22. DTW_LOG_LEVEL Values

Values Description
OFF Net.Data does not log errors. OFF is the default.
ERROR Net.Data logs error messages.
WARNING Net.Data logs warnings, as well as error messages.

Examples

%DEFINE DTW_LOG_LEVEL="ERROR"

DTW_MACRO_FILENAME


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

The name and extension of the current Net.Data macro file.

This variable is a predefined variable and its value cannot be modified. Use the variable as a variable reference.

Examples

<P>This Net.Data macro is <I>$(DTW_MACRO_FILENAME)</I>,
and was updated on $(DTW_MACRO_LAST_MODIFIED).

DTW_MACRO_LAST_MODIFIED


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

The date and time the Net.Data macro was last modified. The output format depends on the system on which Net.Data runs.

This variable is a predefined variable and its value cannot be modified. Use the variable as a variable reference.

Examples

<P>This Net.Data macro is <I>$(DTW_MACRO_FILENAME)</I>,
and was updated on $(DTW_MACRO_LAST_MODIFIED).

DTW_MBMODE


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X
X X X

Purpose

Provides multiple-byte character set (MBCS) support for string and word functions used by the Default language environment. You can set this variable in the Net.Data initialization file, but you can use it in the macro to set or override the current setting.

Specify the value of this variable using a DEFINE statement or with the @DTW_ASSIGN() function.

You can set this variable in the Net.Data initialization file, but you can use it in the macro to set or override the current setting.

OS/400 users: Net.Data for OS/400 automatically enables functions for MBCS support and does not need this variable. Net.Data for OS/400 ignores this variable in macros that are migrated to the OS/400 operating system.

This configuration variable works with the DTW_UNICODE configuration variable. If DTW_UNICODE uses the default value of NO, the value of DTW_MBMODE is used. If DTW_UNICODE is set to a value other than NO, its value is used. Table 23 illustrates how the settings of these two variables determine how built-in functions process strings:

Table 23. Relationship Between the Settings of DTW_UNICODE and DTW_MBMODE

If DTW_UNICODE is set to ... If DTW_MBMODE=YES If DTW_MBMODE=NO
NO Supports DBCS mixed with SBCS Supports SBCS only
UTF8 Supports UTF-8 Supports UTF-8

Values

DTW_MBMODE="YES"|"NO"

Table 24. DTW_MBMODE Values

Values Description
YES Specifies MBCS support for string and word functions.
NO Specifies that string and word functions do not have MBCS support. NO is the default.

Examples

Example 1: Overrides the value in the INI file

INI file:

DTW_MBMODE NO
 

Macro:

 %DEFINE DTW_MBMODE = "YES"

DTW_MP_PATH


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

The path and name of the Net.Data executable file. Depending on your system, the output looks like the following sample path and name:

/usr/lpp/internet/server_root/cgi-bin/db2www

This variable is a predefined variable and its value cannot be modified. Use the variable as a variable reference.

Examples

The Net.Data executable file is $(DTW_MP_PATH).

DTW_MP_VERSION


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

The version and release number of Net.Data running on the server.

This variable is a predefined variable and its value cannot be modified. Use the variable as a variable reference.

Examples

This Web application uses $(DTW_MP_VERSION).

DTW_PRINT_HEADER


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

Specifies text for the HTTP header.

You must have this variable set before Net.Data processes any text sent to the Web browser, because Net.Data reads this variable once before displaying text and does not look at it again. Any changes to the DTW_PRINT_HEADER variable are ignored after Net.Data has sent text to the browser.

If you are using DTW_PRINT_HEADER to generate your own headers (DTW_PRINT_HEADER = "NO"), you must set DTW_REMOVE_WS to "NO".

Specify the value of this variable using a DEFINE statement or with the @DTW_ASSIGN() function.

Values

DTW_PRINT_HEADER="YES"|"NO"

Table 25. DTW_PRINT_HEADER Values

Values Description
YES Net.Data prints out the text Content-type: text/html for the HTTP header. YES is the default.
NO Net.Data does not print out an HTTP header. You can generate custom HTTP header information.

Examples

One of the most common uses of this variable is to enable Net.Data macros to send cookies. To set a cookie, the DTW_PRINT_HEADER variable must be set to NO, and the first three lines must be the Content-type header, the Set-Cookie statement, and a blank line.

Example 1: Enabling Net.Data to send a cookie

%DEFINE DTW_PRINT_HEADER="NO"
 
%HTML(cookie1) {
Content-type: text/html
Set-Cookie: UsrId=56, expires=Friday, 12-Dec-99, 12:00:00 GMT; path=/
 
<P>
Any text
%}

DTW_REMOVE_WS


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

Reduces the size of a dynamically generated Web page by compressing extra space caused by tabulators, white space, and new-line characters.

Specify the value of this variable in the DEFINE block.

Using <PRE></PRE> tags: Defining this variable to YES affects the amount and type of white space that is printed. If the variable is set to YES, portions of HTML pages that use <PRE></PRE> tags might not display as intended.

If you are using DTW_PRINT_HEADER to generate your own headers (DTW_PRINT_HEADER="NO"), you must set DTW_REMOVE_WS to "NO".

OS/390 users: Set this variable in the Net.Data initialization file to specify a value for all of your macros. You can override the value by defining it in the macro. If DTW_REMOVE_WS is not defined in the macro, it uses the value in the initialization file.

Values

DTW_REMOVE_WS="YES"|"NO"

Table 26. DTW_REMOVE_WS Values

Values Description
YES Net.Data compresses a sequence of two or more white spaces to one new-line character, generating shorter HTML result pages.
NO Net.Data does not compress white spaces. NO is the default.

Examples

Example 1: Compressing white space

DTW_REMOVE_WS="YES"
 

RETURN_CODE


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

The return code returned by a call to a built-in function or a call to a language environment. Net.Data uses this value to process MESSAGE blocks. You can use this variable to determine whether a function call succeeded or failed. A value of zero indicates successful completion of a function call.

You can reference the RETURN_CODE variable in any part of the Net.Data macro.

This value is predefined; it is not recommended to modify the value. Use it as a variable reference.

Examples

Example 1: A message stating whether the function completed successfully

@function1()
%IF ("$(RETURN_CODE)" == "0")
 The function completed successfully.
%ELSE
The function failed with the return code $(RETURN_CODE).
%ENDIF

Example 2: A default message when a return code is not 0

%MESSAGE{
default: "<h2>Net.Data received return code: $(RETURN_CODE)</h2>" : continue
%}

If a function returns a return code other than 0, the default message is displayed.


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