Set Stream File Size (QHFSETSZ) API


  Required Parameter Group:

1 Open file handle Input Char(16)
2 File size Input Binary(4) Unsigned
3 Error code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: No

The Set Stream File Size (QHFSETSZ) API sets the size of a stream file in bytes. Applications can use the QHFSETSZ API to increase or decrease the size of a stream file that has been opened with write only or read/write access.

Existing locks on the file are maintained. If the entire file is locked, you cannot change its size. If part of the file is locked, the new size cannot interfere with the locked part. The description of the file size parameter discusses these restrictions.


Authorities and Locks

None.


Required Parameter Group

Open file handle
INPUT; CHAR(16)

The handle returned from the Open Stream File (QHFOPNSF) API when the file was opened. The file must have been opened with write only or read/write access.

File size
INPUT; BINARY(4) UNSIGNED

The size to make the file, in bytes. The size cannot start or end within a range of bytes locked in deny write or deny read/write mode, and it cannot extend beyond a locked range. If a locked range was not previously within the file, the file cannot be extended to include that range. If a locked range is within the file, the file cannot be truncated to exclude that range.

When the file size is increased, the file system may not define the value of the new bytes. When the file size is decreased, the data in the truncated part of the file is lost.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Error Messages

Message ID Error Message Text
CPF1F2B E Write operation not allowed to file opened for read only.
CPF1F2E E Range of bytes in file in use.
CPF1F25 E File handle not valid.
CPF1F28 E Damaged file.
CPF1F4B E Value for number of bytes not valid.
CPF1F41 E Severe error occurred while addressing parameter list.
CPF1F52 E Error code not valid.
CPF1F61 E No free space available on media.
CPF1F62 E Requested function failed.
CPF1F63 E Media is write protected.
CPF1F66 E Storage needed exceeds maximum limit for user profile &1.
CPF1F71 E Exception specific to file system occurred.
CPF1F72 E Internal file system error occurred.
CPF1F73 E Not authorized to use command.
CPF1F74 E Not authorized to object.
CPF1F82 E Function not supported.
CPF1F87 E Missing or damaged exit program &2.
CPF3C90 E Literal value cannot be changed.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


API introduced: V2R1

[ Back to top | Hierarchical File System APIs | APIs by category ]