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