Previous Topic
Table Of Contents
Parent Topic
Next Topic

High-Level Language SWSFINF (SWPFGI) Function

Related Topics

Web Server API Function Index


gfnotsgn.gif (211 bytes) May not be used in Shadow/REXX. Refer to the built-in variables for file information.
gfnotsgn.gif (211 bytes) May not be used from Other REXX Interpreters. Refer to the built-in variables for file information.
HLL Entry point name is SWPFGI

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

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

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

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

CALL Arguments

The SWSFINF (entry point "SWPFGI") 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 InOut A SWSPostFileInfoBlock data area. The FileNumber field of this data area must be filled-in with the number of the file to retrieve attributes for. This number must be from 1 to the number returned by a SWSFCNT call.
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

SWSFINF:

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

Possible values are:

SWS_SUCCESS
The operation suceeded. The information has been placed in the provided area.
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 has failed.

The SWSFINF operation is logged to the Server's wrap-around trace file with the returned 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 SWSFINF(SCONN, SWSPFI, STORAGE(SWSPFI)); /* Get 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     */
      ...                             /* 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.
*       process file
     ...
     0000-SWSINFO-EXIT.
        EXIT.
 

Top