|
|
High-Level Language SWSFILE (SWCPFI) FunctionRelated Topics
SWSFILE is the Web Server API function used to retrieve data from an MVS dataset and transmit it to a Web Client program. The caller specifies the MVS dataset from which data is to be retrieved and the MIME content type to be used when the information is transmitted. For text format data, the Server processes HTML Extension Statements, if any, within the data file before the information is transmitted to the Web Client. This facility allows the information to be specially tailored in response to run-time conditions. The SWSFILE (SWCPFI) interface supports two operation request types:
SWCPFI Call ArgumentsThe SWSFILE (SWCPFI) function arguments are described in the table which follows. For send requests, each of the six arguments described must be present on the API CALL. Omit the sixth argument for queue operation requests.
Return ValuesSWSFILE always sets a signed numeric return code value. Possible values are:
PL/I Example
DCL SCONN PTR; /* Connection Handle*/
DCL SDDNA CHAR(8) INIT('HTMFILE'); /* File DDNAME */
DCL SDSNA CHAR(44) INIT('MY.HTML.DATA'); /* File DSNAME */
DCL SDSNA2 CHAR(44) INIT('SOME.QSAM.DATA');/* File DSNAME */
DCL SMENA CHAR(8) INIT('HLLFILE'); /* Member name */
DCL SMENA2 CHAR(8) INIT('MYFILE'); /* Member name */
DCL SDUMMY FIXED BIN(31) INIT(0); /* NULL Argument */
DCL SCOTY CHAR(50) INIT('text/html'); /* Content type */
DCL SCOTY2 CHAR(50) INIT('image/gif'); /* Content type */
DCL SCOTY3 CHAR(50) INIT('text/plain');/* Content type */
DCL RC FIXED BIN(31); /* return code */
DCL DMHX FIXED BIN(31) BASED; /* Dummy Handle */
ADDR(SCONN)->DMHX = 0; /* Clear Connection Handle */
/* Send the member HLLFILE from the PDS allocated to the */
/* HTMFILE DD name using MIME type text/html. */
CALL SWSFILE( SCONN, /* Connection handle */
SWS_FILE_SEND, /* Send a file */
SWS_FILE_DDNAME + /* Arg 4 is a DD name */
SWS_SEND_TEXT, /* data is text format */
SDDNA, /* Send from this DDNAME */
SMENA, /* Send this member */
SCOTY ); /* File content */
RC = PLIRETV(); /* get return code */
IF RC ^= SWS_SUCCESS THEN /* exit program if bad RC */
EXIT;
/* Send binary data from the PDS 'MY.HTML.DATA(MYFILE) as */
/* MIME type image/gif. */
CALL SWSFILE( SCONN, /* Connection handle */
SWS_FILE_SEND, /* Send a file */
SWS_FILE_DSNAME + /* Arg 4 is a DSNAME */
SWS_FILE_BINARY, /* data in binary format */
SDSNA, /* Send from this DSNAME */
SMENA2, /* Send this member */
SCOTY2 ); /* File content */
RC = PLIRETV(); /* get return code */
IF RC ^= SWS_SUCCESS THEN /* exit program if bad RC */
EXIT;
/* Send the sequential file 'SOME.QSAM.DATA' as MIME type */
/* text/plain. */
CALL SWSFILE( SCONN, /* Connection handle */
SWS_FILE_SEND, /* Send a file */
SWS_FILE_DSNAME + /* Arg 4 is a DSNAME */
SWS_FILE_TEXT /* data in text format */
SDSNA2, /* Send from this DSNAME */
SDUMMY, /* NULL argument */
SCOTY3 ); /* File content */
RC = PLIRETV(); /* get return code */
IF RC ^= SWS_SUCCESS THEN /* exit program if bad RC */
EXIT;
C Example
HDBC sConn = NULL; /* Connection Handle */
long RC; /* return code */
/* Send the HLLFILE member from the PDS allocated with the */
/* DD name HTMFILE as MIME type text/html. */
rc = SWSFile( &sConn, /* Connection handle */
SWS_FILE_SEND, /* Send a file */
SWS_FILE_DDNAME | /* Arg 4 is a DD name */
SWS_SEND_TEXT, /* data is text format */
"HTMFILE", /* Send from this DDNAME */
"HLLFILE", /* Send this member */
"text/html" ); /* File content */
if (rc ^= SWS_SUCCESS) return; /* exit program if bad RC */
/* Send 'MY.HTML.DATA(MYFILE)' as MIME type image/gif */
rc = SWSFile( &sConn, /* Connection handle */
SWS_FILE_SEND, /* Send a file */
SWS_FILE_DSNAME | /* Arg 4 is a DSNAME */
SWS_SEND_BINARY, /* data is binary format */
"MY.HTML.DATA", /* Send from this DSNAME */
"MYFILE", /* Send this member */
"image/gif" ); /* File content */
if (rc ^= SWS_SUCCESS) return; /* exit program if bad RC */
/* Send 'SOME.QSAM.DATA' as MIME type text/plain. */
rc = SWSFile( &sConn, /* Connection handle */
SWS_FILE_SEND, /* Send a file */
SWS_FILE_DSNAME | /* Arg 4 is a DSNAME */
SWS_SEND_TEXT, /* data is binary format */
"SOME.QSAM.DATA", /* Send from this DSNAME */
"", /* NULL argument */
"text/plain" ); /* File content */
if (rc ^= SWS_SUCCESS) return; /* exit program if bad RC */
COBOL Example
77 SCONN USAGE IS POINTER.
77 SDDNA PIC X(8) VALUE 'HTMFILE'.
77 SDSNA PIC X(44) VALUE 'MY.HTML.DATA'.
77 SDSNA2 PIC X(44) VALUE 'SOME.QSAM.DATA'
77 SMENA PIC X(8) VALUE 'HLLFILE'.
77 SMENA2 PIC X(8) VALUE 'MYFILE'.
77 SCOTY PIC X(50) VALUE 'text/html'.
77 SCOTY2 PIC X(50) VALUE 'image/gif'.
77 SCOTY3 PIC X(50) VALUE 'text/plain'.
77 SDUMMY PIC S9(5) COMP VALUE 0.
77 SOPTION PIC S9(5) COMP.
* SEND THE HLLFILE MEMBER FROM THE PDS ALLOCATED TO
* THE HTMFILE DD NAME AS MIME TYPE text/html.
COMPUTE SOPTION = SWS-FILE-DDNAME + SWS-SEND-TEXT.
CALL 'SWCPFI' USING SCONN,
SWS-FILE-SEND,
SOPTION,
SDDNA,
SMENA,
SCOTY.
MOVE RETURN-CODE TO WS-SWSAPI-RETURN-CODE.
IF NOT SWS-SUCCESS GOBACK.
* SEND 'MY.HTML.DATA(MYFILE)' AS MIME TYPE image/gif.
COMPUTE SOPTION = SWS-FILE-DSNAME + SWS-SEND-BINARY.
CALL 'SWCPFI' USING SCONN,
SWS-FILE-SEND,
SOPTION,
SDSNA,
SMENA2,
SCOTY2.
MOVE RETURN-CODE TO WS-SWSAPI-RETURN-CODE.
IF NOT SWS-SUCCESS GOBACK.
* SEND 'SOME.QSAM.DATA AS MIME TYPE text/plain.
COMPUTE SOPTION = SWS-FILE-DSNAME + SWS-SEND-TEXT.
CALL 'SWCPFI' USING SCONN,
SWS-FILE-SEND,
SOPTION,
SDSNA2,
SDUMMY,
SCOTY3.
MOVE RETURN-CODE TO WS-SWSAPI-RETURN-CODE.
IF NOT SWS-SUCCESS GOBACK.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||