|
|
High-Level Language SWSFINF (SWPFGI) FunctionRelated Topics
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 ArgumentsThe SWSFINF (entry point "SWPFGI") function takes three arguments. All three arguments must be specified on the call.
Return ValuesSWSFINF:
Possible values are:
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;
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.
| ||||||||||||||||||||||||||||||||||