|
The ADDRESS SWSSEND Host Command EnvironmentRelated Topics Supported EnvironmentsThe built-in ADDRESS SWSSEND Host Command Environment can be used in the following environments:
For environments where ADDRESS SWSSEND is unavailable, use the following:
Use and OperationThe ADDRESS SWSSEND host command environment is built-in to Shadow/REXX and can only be used by /*WWW transaction procedures. It provides an interface for creating an outbound Web transaction response and has the following advantages over the SWSSEND built-in function:
'Commands' passed to the ADDRESS SWSSEND environment are not actually commands at all, in the normal sense. Statements passed to the interface are data which is buffered for output to the Web client.
ADDRESS SWSSEND SyntaxThe ADDRESS SWSSEND environment is referenced as for all REXX-language host command environments. You may code a stand-alone statement in the form: ADDRESS SWSSEND "data" Or, you may pass multiple commands to the environment as: ADDRESS SWSSEND "data1" "data2" "data3"
ADDRESS SWSSEND OperationEach 'command' passed to the ADDRESS SWSSEND environment is examined by the interface for special control values. If the command string does not contain a special control value, it is buffered for subsequent output to the Web client. The following rules are applied to 'command' data passed to the ADDRESS SWSSEND host environment.
Return ValuesAfter each 'command' line is passed to the ADDRESS SWSSEND environment, the built-in REXX variable, RC, is set to indicate the success or failure of the operation. A return code of 0 indicates that the operation completed successfully. Any other return code indicates a failure of the request, either due to the loss of the communications session or an internal error.
ExamplesThe following illustrates the use of ADDRESS SWSSEND in creating a text or HTML response: ADDRESS SWSSEND "HTTP/1.0 200 OK" "Content-type: text/html" "" "<HTML><BODY>" "<H1>This is the Header</H1>" "<P>Additional text follows..." "</BODY></HTML>" The following calls generate binary format data: glength=0 DO I = 1 TO GIFDATA.0 glength = LENGTH(GIFDATA.I) + glength END ADDRESS SWSSEND "HTTP/1.0 200 OK" "Content-type: image/gif" "Content-length: "glength "" DO I = 1 to GIFDATA.0 '00'X||GIFDATA.I END The following calls purge previously buffered data and create a new transaction response: ADDRESS SWSSEND purgecmd = 'FF'X||"PURGE" purgecmd "HTTP/1.0 304 URL Moved" "Location: /new/url/location" "" |