z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


ftrunc

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-ftrunc--fd--file_size---------------------------------------><

Function

ftrunc invokes the ftrunc callable service to change the size of the file identified by the file descriptor.

Parameters

fd
The file descriptor (a number) for the file.
file_size
The new size of the file, in bytes.

Usage notes

  1. The ftrunc service changes the file size to file_size bytes, beginning at the first byte of the file. If the file was previously larger than file_size, all data from file_size to the original end of the file is removed. If the file was previously shorter than file_size, bytes between the old and new lengths are read as zeros.
  2. Full blocks are returned to the file system so that they can be used again, and the file size is changed to the lesser of file_size or the current length of the file.
  3. The file offset is not changed.

Example

In the following example, assume that fd was assigned a value earlier in the exec. To truncate fd to 0 bytes:
"ftrunc" fd 0

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014