VAR command


Syntax:

  VAR [TYPE content-type] [BINARY|TEXT] [AS name] NAME varname

The contents of the Rexx variable named by 'varname' will be sent to the client. 'varname' is a symbolic name, as it would be written in the filter, and should be no more than 50 characters long. The variable named must have been assigned a value, or an error will be returned.

After this command has ended, the connection to the client is closed, so this is a 'completion command'.

The optional keywords may be specified, in any order, and have the following effects:

Here are some examples (see also GOREMOTE.80):

  1. Returning an HTML document to a Web client:
      /* This is Rexx code */
      doc='<html> .... </html>'          /* may be large */
      'var type text/html name doc'      /* return the data */
      return 
    
  2. Returning some binary data to a Web client:
      /* This is Rexx code */
      data='001122334455'x               /* may be large, '00'x is OK */
      'var type application/octet-stream name data'  /* this sends it */
      return 
    

Notes:

  1. The filter must be active when the VAR command is executed (or the variable will not exist). Therefore this command cannot be passed back to the server by a RETURN instruction for later execution.
  2. All data sent to a client with an HTTP header should be described by a Content-Type field in the header; GoServe will therefore only generate a header automatically if the TYPE option was specified or the HEADER command has been used to add header lines. In this latter case, it is the responsibility of the filter to supply the Content-Type field if the TYPE option was not used.

[ previous section | GoServe | next section ]

From 'goserve.doc', version 2.32.
Copyright © International Business Machines Corporation, 1993, 1995.
All rights reserved.