Previous Topic Table Of Contents Parent Topic Next Topic |  | # Deprecated SWSFILE (SWCPFI) Sub-Function: SWS_FILE_PDSSEND This sub-function is being retired in favor of the enhanced SWS_FILE_SEND sub-function. In future, new enhancements will only be made to the enhanced sub-function. We recommend that all new HLL application be written using the enhanced SWS_FILE_SEND function. Previously written HLL programs need not be re-written; the Server will continue to support the deprecated SWS_FILE_PDSSEND interface as documented on this page. ## CALL Arguments For the Deprecated Function The SWSFILE function takes six arguments. All six arguments must be specified.
Arg. No. | HLL Argument Type | I/O | Description of Argument
--- | --- | --- | ---
C | COBOL | PL/I
1 | HDBC | USAGE POINTER | PTR | Input | The Web Server connection handle. The connection handle is an opaque, four-byte address pointer. The connection handle is currently not used, and must be set to zero (NULL).
2 | UDWORD | PIC S9(5) COMP | FIXED BIN(31) | Input | Specify SWS_FILE_PDSSEND to invoke the deprecated interface as documented here. Refer to the current SWSFILE API for all other cases.
3 | UDWORD | PIC S9(5) COMP | FIXED BIN(31) | Input | A four-byte flag-word indicating options to be used in performing the requested sub-function. The following option flags may be specified, either singly, or in combination: SWS_SEND_TEXT The data to be sent exists in text format. It is translated by the server, during output, to ASCII. SWS_SEND_BINARY The data to be sent exists in binary format. It is transmitted by the server, as is. SWS_FILE_NOHTX This value indicates that HTML extension processing should not be performed during the output operation. This flag may be combined with the SWS_SEND_TEXT flag. SWS_FILE_HTX_REXXRULES This value indicates that uninitialized variables located during HTML extension processing are replaced with the upper case variable name. If SWS_FILE_HTX_REXXRULES is not specified, uninitialized variables are replaced with a NULL string. This option may be combined with the SWS_SEND_TEXT flag.
4 | UCHAR * | PIC X(8) | CHAR(8) | Input | The 8-byte, blank padded DD name for the file. A shorter string may be specified if the string is null terminated.
5 | UCHAR * | PIC X(8) | CHAR(8) | Input | The 8-byte, blank padded member name to be transmitted. A shorter string may be specified if the string is null terminated.
50 | UCHAR * | PIC X(50) | CHAR(50) | Input | The 50-byte, blank padded MIME content type value to be used when the data is transmitted. A shorter string may be specified if the string is null terminated.

Top

## Return Values

SWSFILE always sets a signed numeric return code value. Possible values are:

SWS_SUCCESS
  The operation succeeded. The specified operation was performed.
SWS_NO_DATA_FOUND
  Indicates that the DD name or PDS member name was invalid.

SWS_ERROR

  A parameter validation or run-time error was encountered. Error information is available using the SWSERROR function.

SWS_ENVIRONMENT_ERROR
  The request can not be processed because of a run-time environmental error. For example, you invoked the API service outside of a Web transaction procedure or from outside the server's address space. Use the server's wrap-around trace to obtain diagnostic information.

SWS_INVALID_HANDLE
  The connection handle argument is invalid. No error information can be returned using SWSERROR.
Any other value
  The operation failed. Generally this indicates an unrecoverable loss of the communications session between the Shadow OS/390 Web Server and the client's Web browser program.

## PL/I Example

        DCL  SCONN     PTR;                 /* Connection Handle       */
        DCL  SDDNA     CHAR(8) INIT('HTMFILE');  /* File DD name       */
        DCL  SMENA     CHAR(8) INIT('HLLFILE');  /* Member name        */
        DCL  SCOTY     CHAR(50) INIT('text/html');  /* Content type    */
        DCL  RC        FIXED BIN(31);       /* return code             */
        DCL  DMHX      FIXED BIN(31) BASED; /* Dummy Handle field      */

        ADDR(SCONN)->DMHX = 0;              /* Clear Connection Handle */

        CALL SWSFILE( SCONN                 /* send the text data      */
                      SWS_FILE_PDSSEND,
                      SWS_SEND_TEXT,
                      SDDNA,
                      SMENA,
                      SCOTY );
        RC = PLIRETV();                     /* get return code         */
        IF RC ^= SWS_SUCCESS THEN           /* exit program if bad RC  */
           EXIT;

Top

## C Example

        HDBC sConn   = NULL;                /* Connection Handle       */
        long RC;                            /* return code             */

        rc = SWSFILE( &sConn,               /* send the text data      */
                      SWS_FILE_PDSSEND,
                      SWS_SEND_TEXT,
                      "HTMFILE",
                      "HLLFILE",
                      "text/html" );
        if (rc ^= SWS_SUCCESS) return;      /* exit program if bad RC  */

Top

## COBOL Example

        77  SCONN                USAGE IS POINTER.
        77  SDDNA                PIC X(8) VALUE 'HTMFILE'.
        77  SMENA                PIC X(8) VALUE 'HLLFILE'.
        7   SCOTY                PIC X(50) VALUE 'text/html'.

        CALL 'SWCPFI' USING SCONN,
                      SWS-FILE-PDSSEND,
                      SWS-SEND-TEXT,
                      SDDNA,
                      SMENA,
                      SCOTY.
        MOVE RETURN-CODE TO WS-SWSAPI-RETURN-CODE.
        IF NOT SWS-SUCCESS GOBACK.

Top