$Web_Flush

From m204wiki
Jump to navigation Jump to search

Clear contents of Web response buffer

$Web_Flush clears the contents of the client buffer.

$Web_Flush takes no arguments and returns a numeric status code. It is a callable $function.

Syntax

%rc = $Web_Flush

Syntax terms

%rc A numeric status code:
Code Meaning
0 Completed successfully
-1 Not a web thread

Usage notes

  • Everything sent to a client is buffered and sent at the completion of the request. This allows lines to be put to the client buffer (CCATEMP) from many points in the application, and the send to be performed once. $Web_Flush clears the client buffer and allows the application to begin building the buffer over again from scratch.
  • Use $Web_Flush when the application detects an error and needs to change the sent content.

Examples

ON FIND CONFLICT %x = $Web_Flush %x = $Web_Type('text/HTML') %x = $Web_ProcSend( 'WEBFILE', 'OFC.HTML' ) STOP END ON

In the above example, $Web_Flush is used in an ON unit to clear any information in the client buffer before the content type is set and the static HTML in procedure OFC.HTML is sent to the client.

See also