|
The SWSFILE Function with Other REXX-language InterpretersRelated Topics
When used with Other REXX-language Interpreters SWSFILE built-in function can be used to transmit data with an external dataset directly to a Web client. It may also be used to retrieve information about external datasets for the REXX-language procedure.
SWSFILE SyntaxThe SWSFILE function incorporates several operation types. The first argument to the function call must be the name of the specific operation to be performed. The remaining arguments needed for the function call depend on which operation is being invoked. The general form for a REXX-language invocation of SWSFILE is: rc = SWSFILE( opertype, arg1, ... , argn ) Valid Operation TypesOne of the following operation types must be coded as the first argument to the call (shown as opertype in the example above).
The remaining arguments which must be coded for each operation type is given below. A table, at the end of this page, explains how to code each of the arguments. Whenever text format data is transmitted to a Web client (SEND operations), the Server processes HTML Extension Statements to tailor the output. This facility allows the file-resident data to be customized at run-time.
The SEND OperationSEND is used to transmit a member of a PDS dataset or a sequential dataset to the Web client. The function will create and transmit an HTML response header, followed by the file-resident data. Coding SEND RequestsTo code the SWSFILE function call for SEND, use the following format: zrc = SWSFILE("SEND",nametype,filename,mbrname,mimetype,datafmt,htxopt) The arguments for the call are explained in the SWSFILE Arguments Table below. Run-time Operation of SENDSEND can operate on RECFM F, FB, V, VB, or U datasets. RECFM VB is suggested for binary data, and RECFM FB is suggested for text data. When the PDS member or sequential dataset is transmitted outbound, any record-length fields (such as are present for VB format records) are removed and only the raw data is transmitted. The input file data may be ASCII binary data or EBCDIC text data. If "TEXT" format data is specified, trailing EBCDIC blanks are removed from each data record before an ending CR (carriage return) character is appended. Each line is translated from EBCDIC to ASCII before transmission. Unless "NOHTX" was explicitly specified on the function request, HTML Extension values are processed before the member is transmitted. When HTML Extensions are actually present within the input member, transmission of the Last-Modified: HTTP response header is suppressed. Instead, an Expires: header is generating giving the current time. If ISPF-type statistics exist for the PDS member the ISPF last-modified data is used to generate the Last-Modified: HTML response header; otherwise, the Last-modified: HTML response header is not generated. The Last-modified: response header is surpressed if HTML Extension Statements are present and might cause the data to be tailored different for a future request. SEND checks the HTTP transaction headers before actually transmitting the full PDS member outbound. If the inbound HTTP transaction method is "HEAD", only the HTML response header information is transmitted. Similarly, if the inbound URL contained an If-modified-since: specification the Server may transmitted a "Not Modified" (304) response instead of sending the contents of the file. The outbound transmission generated by a successful SEND operation constitutes an entire and complete HTTP response. The REXX process which issues the SWSFILE function should not transmit additional data to the Web client unless some error is returned by the function. SEND Return Values
The STATS OperationSTATS is used to check the status of a PDS member or sequential dataset and return to the REXX procedure information about that member or sequential dataset. This information can be useful in dynamically creating transaction responses from within the REXX procedure. Coding STATS Requests zrc = SWSFILE("STATS",nametype,filename,mbrname,datafmt) Run-Time Operation of STATSSTATS can operate of RECFM F,FB, V, VB, or U datasets. STATS returns a content length, record count and last modification date value which corresponds to information which would be required to transmit the member outbound to a Web client. STATS Return ValuesFor binary format data the member size or sequential dataset size returned will reflect an exact count of the data bytes within each logical record of the PDS member or sequential file. For text format data the member or sequential file is treated as EBCDIC text. In calculating the member or sequential file size, trailing EBCDIC blanks are eliminated, and 1 additional byte per logical record (for the trailing carriage return character) is assumed. If a zero-length record is encountered within a RECFM=V or RECFM=VB file, a single blank is substituted for the zero-length record (zero-length records cannot be created in text files using ISPF, however, then may be present if the data has been uploaded to MVS via FTP). STATS returns a NULL string if the dataset does not exist, or member does not exist within the specified PDS, or if the dataset cannot be accessed. The STATS function returns a character string suitable for processing by REXX using blank-delimited word type processing. The returned string contains the following information:
SWSFILE Arguments TableThe table which follows describes each of the arguments which can be supplied for an SWSFILE function call.
|