Skip to main content

 
IBM Power Systems software  >  IBM i  > Software  > 

Net.Data for i5/OS

  
Overview News Library Education Support
Eliminating White Space

Abstract: Redundant white space, such as blanks and line feeds, can be reduced by using DTW_REMOVE_WS.

What is it?
Newline characters and spaces are send back to the browser if encountered. Depending on the size of the macro and what is being done, you may be sending back 100's of these characters without you knowing it. For example, if you have a loop that executes 100 times and within the loop you have 10 built-in function calls in a row, you may wind up sending 1000 newline characters back to the browser. To eliminate the sending of white space characters, the macro variable DTW_REMOVE_WS was introduced. However, it did not eliminate the problem of newline characters caused by built-in function calls. DTW_REMOVE_WS has been enhanced to remove newline characters caused by built-in function calls. In addition, you can now specify DTW_REMOVE_WS in the Net.Data INI file so that you do not have to specify it in every macro.

Why would I want to use it?
Performance. The less unnecessary data that is sent, the faster the data can be sent to the browser and the faster the browser can process the data.

How do I use it?
You can specify DTW_REMOVE_WS in the INI file as follows:

    DTW_REMOVE_WS YES

Or, you can specify it in the macro:

    %DEFINE DTW_REMOVE_WS="YES"

Users who specify DTW_PRINT_HEADER="NO" in a macro can use DTW_REMOVE_WS, however, you have to ensure that your header lines are ended by newline characters. Here is an example:

Listing 1.

%define DTW_REMOVE_WS="YES"
%define DTW_PRINT_HEADER="NO"
@dtw_assign(newline, dtw_rhexttochar("0D25"))

%HTML(report) {
Expires: Fri, 30 Oct 1998 12:00:GMT$(newline)
Content-Type: text/html$(newline)$(newline)
.
.
.
%}

You can read about DTW_REMOVE_WS in the Net.Data Reference.

Availability
V3R2, V3R7 and subsequent releases. Ensure you have the latest Net.Data PTF.