File server

Identify IBM® i exit points for file serving.

Start of changeThe file server has one defined exit point, QIBM_QPWFS_FILE_SERV, which supports two formats: PWFS0100 and PWFS0200. Only one exit program is called by the server for a function. If a program is registered for both formats, only the program that is registered for format PWFS0200 is called.End of change

The QIBM_QPWFS_FILE_SERV exit point is defined to run an exit program for the following types of file server requests:

  • Change file attributes
  • Create stream file or create directory
  • Delete file or delete directory
  • List file attributes
  • Move
  • Open stream file
  • Rename
  • Allocate conversation
  • Start of changeCopy (format PWFS0200 only)End of change
Notes:
  • For the file server, the exit program name is resolved when the QSERVER subsystem is activated. If you change the program name, you must end and restart the subsystem for the change to take effect.
  • For file server requests that provide the file name to the exit program, the user must have a minimum of *RX authority to each directory in the path name preceding the object. If the user does not have the required authority, the request fails.
  • If the file server exit program swaps to another user and does not swap back to the original user, the file server session continues to operate with the user that originally connected to the session. This is because the host file server and IBM i NetServer get credential information for the user who did the initial connection to the session and uses this credential information when doing client requests. With the host file server and IBM i NetServer using the credential information, any swapping of the user profile in the file server exit program is not used by the file server for file system operations.

Exit point QIBM_QPWFS_FILE_SERV format PWFS0100

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For the file server, the value is *FILESRV.
20 14 BINARY(4) Requested function The function being performed:
  • X'0000' - Change file attributes request
  • X'0001' - Create stream file or directory request
  • X'0002' - Delete file or delete directory request
  • X'0003' - List file attributes request
  • X'0004' - Move request
  • X'0005' - Open stream file request
  • X'0006' - Rename request
  • X'0007' - Allocate conversation request
24 18 CHAR(8) Format name The user exit format name being used. For QIBM_QPWFS_FILE_SERV, the format name is PWFS0100.
32 20 CHAR(4) File access If the requested function has a value of X'0005' (open), this field contains the following structure:
  • Read access, CHAR(1) X'F1' - Yes X'F0' - No
  • Write access, CHAR(1) X'F1' - Yes X'F0' - No
  • Read/write access, CHAR(1) X'F1' - Yes X'F0' - No
  • Delete allowed, CHAR(1) X'F1' - Yes X'F0' - No
36 24 BINARY(4) File name length The length of the file name (the next field). The length can be a maximum of 16 MB. If the requested function has a value of X'0007' (Allocate conversation request), the file name length is 0.
40 28 CHAR(*) File name The name of the file. The length of this field is specified by the file name length (the previous field). The file name is returned in CCSID 1200.
If a requested function has a value of one of the following, the file name is provided and the file name length is set:
  • X'0000' - Change file attributes request
  • X'0001' - Create stream file or directory request
  • X'0002' - Delete file or delete directory request
  • X'0003' - List file attributes request
  • X'0004' - Move request
  • X'0005' - Open stream file request
  • X'0006' - Rename request
Notes:
  • This format is defined by member EPWFSEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC, and QCBLLESRC in library QSYSINC.
  • The APIs available to convert to and from CCSID 1200 are iconv() and CDRCVRT.
Start of change

Exit point QIBM_QPWFS_FILE_SERV format PWFS0200

Offset Type Field Description
Dec Hex
0 0 CHAR(10) User profile name The name of the user profile that is calling the server
10 A CHAR(10) Server identifier For the file server, the value is *FILESRV.
20 14 BINARY(4) Requested function The function being performed:
  • X'0000' - Change file attributes request
  • X'0001' - Create stream file or directory request
  • X'0002' - Delete file or delete directory request
  • X'0003' - List file attributes request
  • X'0004' - Move request
  • X'0005' - Open stream file request
  • X'0006' - Rename request
  • X'0007' - Allocate conversation request
  • X'0008' - Copy request
24 18 CHAR(8) Format name The user exit format name being used. For QIBM_QPWFS_FILE_SERV, the format name is PWFS0200.
32 20 CHAR(4) File access If the requested function has a value of X'0005' (open), this field contains the following structure:
  • Read access, CHAR(1) X'F1' - Yes X'F0' - No
  • Write access, CHAR(1) X'F1' - Yes X'F0' - No
  • Read/write access, CHAR(1) X'F1' - Yes X'F0' - No
  • Delete allowed, CHAR(1) X'F1' - Yes X'F0' - No
36 24 CHAR(10) Object type The type of object being created. If the requested function has a value of X’0001’ (Create stream file or directory request), the object type is set to one of the following values.
  • *STMF “ - Stream file being created
  • *DIR “ - Directory being created
46 2E CHAR(6) Reserved Unused area.
52 34 BINARY(4) File name offset The offset from the start of the format to the name of the object. Zero is set if the requested function has a value of X'0007' (Allocate conversation request).
56 38 BINARY(4) File name length The length of the file name. The length can be a maximum of 16 MB. If the requested function has a value of X'0007' (Allocate conversation request), the file name length is 0.
60 3C BINARY(4) Target file name offset The offset from the start of the format to the target name of the object. The offset is set to a nonzero value if the requested function has a value of X'0004' (Move), x’0006' (Rename), or X’0008’ (Copy request).
64 40 BINARY(4) Target file name length The length of the target file name. The length is set to zero when the target name offset is set to zero.
* * CHAR(*) File name The name of the file. The length of this field is specified by the file name length. The file name is returned in CCSID 1200.

The file name is set if the file name offset field has a value other than zero.

* * CHAR(*) Target file name The name of the target file. The length of this field is specified by the target file name length field. The file name is returned in CCSID 1200.

The target file name is set if the target file name offset field has a value other than zero.

Notes:
  • This format is defined by member EPWFSEP in files H, QRPGSRC, QRPGLESRC, QLBLSRC, and QCBLLESRC in library QSYSINC.
  • The APIs available to convert to and from CCSID 1200 are iconv() and CDRCVRT.
  • The length of this format, including file names, can be a maximum size of 16 MB.
End of change