QzipUnzip()--Decompress an archive file


  Syntax
 #include <qziputil.H>
 void QzipUnzip(
	Qlg_Path_Name_T * compressedFileName, 
	Qlg_Path_Name_T * dirToPlaceDecompFiles, 
	char * formatName, 
	char * unzipOptions, 
	char * errorStruct) 
  Service Program Name: QZIPUTIL

  Default Public Authority: *USE

  Threadsafe: Yes

The QzipUnzip() API will decompress files and directories from a compressed archive ('.zip') file.

Files that are decompressed from a compressed archive file are assigned the coded character set identifier (CCSID) of the job that is invoking the API. However, the CCSID of all files in a directory can be changed using the find QShell utility in conjunction with the setccsid QShell utility. For example, the following QShell command will change the CCSID attribute of all files in directory /mydir, including files in subdirectories, to 819:

find /mydir/* -type f -exec setccsid 819  {} \;

Parameters

compressedFileName
(Input)

The name of the archive file that is to be decompressed. 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 QzipUnzip().

dirToPlaceDecompFiles
(Input)

The directory to place the contents of the 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 QzipUnzip().

formatName
(Input)

The format name to pass the user's options for decompressing an archive file. See UNZIP100 format for a description of this format.

unzipOptions
(Input)

This is a pointer that passes in the user's options to the QzipUnzip() API in UNZIP100 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 decompressed.
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 decompressed file will be written.
Locks on files when this API is used
During the time this API reads a compressed archive file for decompressing it, the file will be locked and shared for reading only. The API will release the lock on the file after reading the file completely. If the file that is to be decompressed is locked, then an error message will be sent. Further decompressing will be stopped.

UNZIP100 Format Description

The following table shows the format for passing the user's options to decompress an archive file. 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) Replace option


Field Descriptions

Replace option. This option specifies if an existing file needs to replaced or not if a file by the same name already exists in the target path. The possible values are *YES and *NO.

Note: This option only applies to File objects. Directory names are ignored.

Verbose option. This option specifies if verbose messages are to be printed to the standard out when the decompressing an archive file. 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 ]