5.37.6 GET

The GET command provides access to the contents of the archive opened with the OPEN command.

Based on the ENTRY keyword value the GET command can be used to:

Syntax:

Command

Keyword

Value

Developer notes

GET

ENTRY

*LIST

Populates the supplied working list with a list of all the zip file entries. The list must have a single field that will contain the full path of the zip file entry (as stored in the zip file).

*READ

Extracts zip file entries matching the PATH or FILE keyword values
or
extracts all entries if neither PATH or FILE is specified.
The files are extracted to the folder specified by the TO keyword. The BASE keyword controls whether path information in the zip file entries is used when extracting the files.
This is the default value.

PATH

value

This value is compared against the full path of the zip file entries to select those that are to be extracted.

This keyword only applies when ENTRY(*READ) is specified, that is, when the GET command is being used to extract files from the current zip archive.

Default values is *ALL.

FILE

value

Specifies the full path of a single entry in the zip archive that is to be extracted.

The FILE keyword only applies when ENTRY(*READ) is specified, that is, when the GET command is being used to extract files from the current zip archive.

Specify either the PATH or FILE keywords. If you specify both only the PATH keyword will be processed.

BASE

 

Specifies whether path information in the zip file entries is used when extracting the files to the directory specified by the TO keyword.

This keyword only applies with ENTRY(*READ) is specified, that is, when the GET command is being used to extract files from the current zip archive.

path

A specific path value indicates the paths stored in the zip file entries are partially used when extracting files to the directory specified by the TO keyword.
The directories that are used are those in that part of the zip file entry paths that are relative to the path specified by this keyword value. The path specified here should therefore be a path that is common to one or more of the zip file entries.

*CURRENT

Indicates that the path stored in the zip file entry is to be disregarded and all files are to be extracted to the directory specified by the TO keyword.

*NONE

Indicates that the full paths stored in the zip file entries are used when extracting files to the directory specified by the TO keyword. The directories present in the full path stored in the zip file entry become descendant directories of the directory specified by the TO keyword.

A value of BASE(*NONE) will fail if the path information in the archive cannot be combined with the path in the TO keyword to form a valid composite path.

OCCURRENCE

*ALL

This keyword only applies when ENTRY(*READ) and FILE keyword are specified.

By default, all occurrences of a file are written out.

*FIRST

If you only require the first or only occurrence of the file to be written out, then use the keyword value *FIRST. Using this value improves the access time to read a single file from the archive.

TO

path

This keyword only applies when ENTRY(*READ) is specified, that is, when the GET command is being used to extract files from the current zip archive.

The TO keyword specifies the path to the directory that will receive the extracted files.
The BASE keyword controls whether path information in the zip file entries is used when extracting the files to the directory specified by the TO keyword.

 

Example

GET ENTRY(*LIST) #WRKLST(ENTRY)

 

GET ENTRY(*READ) TO(/unzip)

 

GET ENTRY(*READ) PATH(*ALL) TO(/unzip)

 

GET ENTRY(*READ) PATH(/folder/folder) TO(/folder)

 

GET ENTRY(*READ) FILE(/folder/file.pdf) TO(/folder)