Previous Topic
Table Of Contents
Parent Topic
Next Topic

High-Level Language SWSFSET (SWPFSI) Function

Related Topics

Web Server API Function Index


May be used in Shadow/REXX
May be used from Other REXX Interpreters
HLL Entry point name is SWPFSI

SWSFSET (entry point "SWPFSI") is a high level function used to change the attributes of files Posted in this operation. The information is passed in a data structure SWSPFI in PL/I, SWS-POST-FILE-INFO-BLOCK in COBOL, and SWS_POST_FILE_INFO_BLOCK in "C".

SWSPostFileSetInfo is the "C" definition for the entry point.

SWSPOSTFILESETINFO is the "COBOL" definition for the entry point.

SWSFSET is the "PL/I" definition for the entry point.

CALL Arguments

The SWSFSET (entry point "SWPFSI") function takes three arguments. All three arguments must be specified on the call.

 

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. This is an opaque, four byte address pointer. Because the connection handle is currently not used, it must be set to zero (NULL).
2 PTR PTR PTR Input A SWSPostFileInfoBlock data area. The FileNumber field of this data area:
  • Must be filled in with the number of the file to change attributes.
  • Must contain a number between 1 to the number returned by a SWSFCNT call.

Only two fields can be modified by this function, flags and toebcdic. The other fields must either be binary zeros (NULL), or the same value as set by a previous SWSFINF call. This is to prevent an inadvertent attempt to change other values.

  • The flags field can only contain 1 or 0. This flag determines whether (1) or not (0) to translate the file data from ASCII to EBCDIC. The initial value is determined by examining the Content-type: header associated with the file.
  • The toebcdic field must contain the four-character name of a valid translate table.
3 UDWORD PIC S9(5) COMP FIXED BIN(31) Input A four-byte integer containing the length of the SWSPostFileInfoBlock area.
  • COBOL. The symbol SWS-POST-FILE-INFO-BLOCK-SIZE provides the size.
  • "C". The sizeof() function provides the size.
  • PL/I. The STORAGE() function provides the size.

Top

Return Values

SWSFSET:

  • Alters file information from the information block data area.
  • Always sets a signed numeric return code value.

Possible values are:

SWS_SUCCESS
The operation succeeded. The information has been changed for the indicated file.
SWS_ERROR
A parameter validation or run-time error was encountered. Error information is available using the SWSERROR function.
SWS_ENVIRONMENT_ERROR
The request cannot 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 has failed.
 

The SWSFSET operation is logged to the Server's wrap-around trace file with the altered information and completion code.

 

PL/I Example

 %INCLUDE SPCPHD;                  /* INCLUDE STANDARD HEADER FILE   */
                                   /* (includes definition of SWSPFI)*/
    DCL   SCONN     PTR;           /* Connection Handle              */
    DCL   FICNT     FIXED BIN(31);  /* Header length                 */
    ADDR(SCONN)->DMHX=0;            /* Zero connection handle        */
    CALL SWSFCNT(SCONN              /* Get the file count            */
             FICNT);
    RC=PLIRETV();                   /* Get return code               */
    IF RC ^=SWS_SUCCESS THEN        /* exit if bad RC                */
             EXIT;
    DO I = 1 TO FICNT;              /* Examine each file             */
       SWSPFI.FILENUM = I;          /* Set the file number           */
       CALL SWSFGET(SCONN, SWSPFI, STORAGE(SWSPFI)); /* Get file info*/
       RC = PLIRETV();
       IF RC ^=SWS_SUCCESS THEN     /* exit if bad RC                */
             EXIT;
       SWSPFI.TOEBCDIC = "ENU ";    /* Force US English              */
       SWSPFI.FLAGS = 1;            /* Force translation             */
       CALL SWSFSET(SCONN, SWSPFI, STORAGE(SWSPFI)); /* Set file info */
       RC = PLIRETV();
       IF RC ^=SWS_SUCCESS THEN     /* exit if bad RC                */
             EXIT;
       ...                          /* Process File                  */
    END;

Top

 

C Example

   HDBC sConn = NULL;                  /* Connection Handle  */
   long FICNT;                         /* file count         */
   long RC;                            /* return code        */
   int i;
   SWS_POST_FILE_INFO_BLOCK info;      /* file attributes    */
   rc = SWSPostFileCount(&sConn,       /* Get the file count */
         &FICNT);
   If(rc ^=SWS_SUCCESS) return;        /* exit if bad rc     */
   for (i = 1; i <= FICNT; I++) {      /* look at each file  */
     info.filenumber = i;              /* set the file number*/
     rc - SWSPostFileGetInfo(&sConn,   /* Get attributes     */
                  &info,               /* information block  */
                  sizeof(info));       /* block size         */
     If(rc ^=SWS_SUCCESS) return;      /* exit if bad rc     */
     info.toebcdic[0] = 'E';           /* force US English   */
     info.toebcdic[1] = 'N';           /* force US English   */
     info.toebcdic[2] = 'U';           /* force US English   */
     info.toebcdic[3] = ' ';           /* force US English   */
     info.flags = 1;                   /* force translation  */
     rc = SWSPostFileSetInfo (&sConn,  /* Set attributes     */
                  &info,               /* information block  */
                  sizeof(info));       /* block size         */
     If(rc ^=SWS_SUCCESS) return;      /* exit if bad rc     */
     ...                             
  /* Process file       */
   }

COBOL Example

 
    COPY SBCPHD.
    77 SCONN         USAGE IS POINTER.
    77 FICNT         PIC S9(5) COMP.
    77 I-COUNT       PIC S9(5) COMP VALUE 0.
    CALL SWSPOSTFILECOUNT USING SCONN,
             FICNT.
    MOVE RETURN CODE TO WS-SWSAPI-RETURN-CODE.
    IF NOT SWS-SUCCESS GOBACK.
    PERFORM 0000-SWSINFO-ROUTINE WITH TEST BEFORE
      VARYING I-COUNT FROM 1 BY 1 UNTIL I-COUNT > FILE-COUNT.
    GOBACK.
*
    0000-SWSINFO-ROUTINE.
     MOVE I-COUNT TO SWSPF-FILE-NUMBER
        OF SWS-POST-FILE-INFO-BLOCK.
     CALL SWSPOSTFILEGETINFO USING CONNECTION-HANDLE
                         SWS-POST-FILE-INFO-BLOCK
                         SWS-POST-FILE-INFO-BLOCK-SIZE.
     IF RETURN-CODE IS NOT EQUAL TO ZERO
        GOBACK.
     MOVE 1 TO FLAGS IN SWS-POST-FILE-INFO-BLOCK.
     MOVE "ENU " TO TOEBCDIC IN SWS-POST-FILE-INFO-BLOCK.
     CALL SWSPOSTFILESETINFO USING CONNECTION-HANDLE
                         SWS-POST-FILE-INFO-BLOCK
                         SWS-POST-FILE-INFO-BLOCK-SIZE.
     IF RETURN-CODE IS NOT EQUAL TO ZERO
        GOBACK.
*       process file
     ...
     0000-SWSINFO-EXIT.
        EXIT.       
 

Top