QzipZip()--Compress Files and Directories


  Syntax
 #include <qziputil.H>
 void QzipZip(
	Qlg_Path_Name_T * fileToCompress, 
	Qlg_Path_Name_T * compressedFileName, 
	char * formatName, 
	char * zipOptions, 
	char * errorStruct)

  Service Program Name: QZIPUTIL

  Default Public Authority: *USE

  Threadsafe: Yes

The QzipZip() API will compress files and directories and creates an archive file.


Parameters

fileToCompress
(Input)

The name of the file or directory that is to be compressed into an archive file. The path name needs to be in Qlg_Path_Name_T structure. For more information see Path name format.

Wild card characters and pattern matching of the path name is not supported.
The only delimiter that is accepted by this API in the Qlg_Path_Name_t structure is a forward slash (/).
The path can be an absolute path name or a relative path name. All relative path names are relative to the current directory at the time of the call to QzipZip().

compressedFileName
(Input)

The name of the compressed archive file. This file is created by the API. The path name needs to be in Qlg_Path_Name_T structure. For more information see Path name format.

Wild card characters and pattern matching of the path name is not supported.
The only delimiter that is accepted by this API in the Qlg_Path_Name_t structure is a forward slash (/).
The path can be an absolute path name or a relative path name. All relative path names are relative to the current directory at the time of the call to QzipZip().

formatName
(Input)

The format name to pass the user's options for compressing a file or a directory to an archive file. See ZIP00100 format for a description of this format.

zipOptions
(Input)

This is a pointer that passes in the user's options to the QzipZip() API in ZIP00100 format.

errorStruct
(Input/Output)

This is a pointer to an error code structure to receive error information. See Error code parameter for more information.


Authorities and Locks

Authority to use the API
The user must have at least a *R data authority to the file that is to be compressed.
The user must have at least a *R data authority to each directory in the path name preceding that file.
The user must have at least a *W data authority to the directory where the compressed file will be written.
Locks on files when this API is used
During the time this API reads a file for compressing it, the file will be locked and shared with reading only mode. The API will release the lock on the file after reading the file completely. If the file that is to be compressed is locked, then an error message will be sent. Further compression will be stopped.

ZIP00100 Format Description

The following table shows the format for passing the user's options to compress files or directories. For a detailed description of each field, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 CHAR(10) Verbose option
10 A CHAR(6) Subtree option
16 10 CHAR(512) Comment
528 210 BINARY(4), UNSIGNED Length of the comment


Field Descriptions

Comment. The contents of the comment parameter in job CCSID is added to the newly created archive file.

Length of the comment. The length of the comment in bytes.

Subtree option. This option specifies whether directory subtrees are included or not when creating an archive file. The following are the possible values.

*ALL - The *ALL subtree option compresses all subdirectories and the objects within those subdirectories.

*NONE - The *NONE option does not compress subdirectories.

In case of a symlink, the API follows the link and compresses the actual file instead of just compressing the symlink.

Verbose option. This option specifies if verbose messages are to be printed to the standard out during the compression process. The following are the possible values.

*VERBOSE - The *VERBOSE option prints verbose messages to the stdout. The system itself does not set up stdin, stdout, stderr descriptors and it is the responsibility of the user of this API to set the descriptors when using the *VERBOSE option. For a detailed description, see File systems.

*NONE - The *NONE option does not print any messages to the stdout.


Error Messages

In addition to the following messages, the API also throws a number of CPF9898 messages that describe what the error is.

CPFA081 Unable to set return value or error code.
CPFA08B Path name cannot begin with *.
CPFA094 Path name not specified.
CPFA09C Not authorized to object. Object is &1.
CPFA09E Object in use. Object is &1.
CPFA0A3 Path name resolution causes looping.
CPFA0A9 Object not found. Object is &1.
CPFA0C7 &1 directory failed to create.
CPFA0CF Error occurred determining the current directory.


Related Information




API introduced: V7R1

[ Back to top | UNIX-Type APIs | APIs by category ]