|
The SWSFILE FunctionRelated Topics
The REXX-language 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 (for the SEND or PDSSEND operations) or is placed into the REXX external data queue (for the QUEUE or PDSQUEUE 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: 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 Requestszrc = SWSFILE("STATS",nametype,filename,mbrname,datafmt) The arguments for the STATS operation are described in the SWSFILE Arguments Table below. 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:
The MBRLIST OperationMBRLIST is used to obtain a list of the PDS members within a library. The list of member names is returned in the REXX external data queue. MBRLIST only operates on PDS or PDSE dataset types. Coding MBRLISTTo code the SWSFILE function call for MBRLIST, use the following format: zrc = SWSFILE("MBRLIST",nametype,filename) The SWSFILE arguments for the MBRLIST operation are described in the SWSFILE Argument Table below. Run-Time Operation of MBRLISTMBRLIST only operations upon PDS or PDSE datasets. The MBRLIST function queues the list of PDS(E) members to the REXX external data queue. The list can be retrieved using the PARSE PULL REXX operation. MBRLIST Return Values
If no members exist within the PDS, the function returns with an empty external data queue and sets return code 0.
The QUEUE OperationQUEUE is used to read a member of a PDS dataset or a sequential file into the REXX external data queue. The QUEUE function is far more efficient than using EXECIO for a similar purpose, and allows you to reference a single DD name for all members of a PDS dataset. The input source may be ASCII binary data or EBCDIC text data. If the input source is in text format, HTML Extensions within the source are processed before the source data is placed into the external queue. Coding QUEUETo code the SWSFILE function call for QUEUE, use the following format: zrc = SWSFILE("QUEUE",nametype,filename,mbrname,datafmt,htxopt) The SWSFILE arguments for the QUEUE operation are described in the SWSFILE Argument Table below. Run-Time Operation of QUEUEWhen the PDS member or sequential dataset is read and copied to the external data queue any record-length fields (such as are present for VB format records) are removed and only the raw data is copied. Trailing blanks are eliminated for TEXT format records. Additionally, for TEXT format records, if a zero-length VB record is read, a single blank is used for the corresponding queue entry (zero-length VB records can, and frequently are, created when members are shipped to an MVS system using FTP). For binary format data no editing of any kind is applied to the data before it is copied to the external data queue. The data is copied to the queue as a continuous string of bytes with each queue entry being exactly as long as the corresponding source logical record. For text format data each input record is stripped of trailing blanks before being copied to the external data queue.
After checking the return code from the QUEUE operation, you can retrieve the records from the external data queue with REXX coding, such as: DO WHILE QUEUED() > 0 PARSE PULL nextlogicalrecord END QUEUE Return Values
The PDSSEND OperationPDSSEND is a legacy operation type from an earlier release of the Server. Equivalent operations may be requested using the SEND request, which is the preferred method for new applications. Coding PDSSEND RequestsTo code SWSFILE function calls using PDSSEND, use the following format: zrc = SWSFILE("PDSSEND",filename,mbrname,mimetype,datafmt,htxopt)
Run-Time Operation of PDSSENDThe operation of PDSSEND is the same as for the SEND request, shown above. PDSSEND Return ValuesReturn values set by PDSSEND are the same as for the SEND request, shown above.
The PDSSTAT OperationPDSSTAT is a legacy operation type from an earlier release of the Server. Equivalent operations may be requested using the STATS request, which is the preferred method for new applications. Coding PDSSTAT RequestsTo code SWSFILE function calls using PDSSTAT, use the following format: zrc = SWSFILE("PDSSTAT",filename,mbrname,datafmt)
Run-Time Operation of PDSSTATThe operation of PDSSTAT is the same as for the STATS request, shown above. PDSSTAT Return ValuesReturn values set by PDSSTAT are the same as for the STATS request, shown above.
The PDSQUEUE OperationPDSQUEUE is a legacy operation type from an earlier release of the Server. Equivalent operations may be requested using the QUEUES request, which is the preferred method for new applications. Coding PDSQUEUE RequestsTo code SWSFILE function calls using PDSQUEUE, use the following format: zrc = SWSFILE("PDSQUEUE",filename,mbrname,datafmt,htxopt)
Run-Time Operation of PDSQUEUEThe operation of PDSQUEUE is the same as for the QUEUE request, shown above. PDSQUEUE Return ValuesReturn values set by PDSQUEUE are the same as for the QUEUE request, shown above.
SWSFILE Arguments TableThe table which follows describes each of the arguments which can be supplied for an SWSFILE function call.
|