GET
The GET command provides access to the contents of the current archive (the archive last successfully opened with the CREATE or OPEN commands).
Based on the ENTRY keyword value the GET command can be used to:
- Populate a working list of entries in the current archive
- Extract and uncompress entries to a specified location
Either the PATH or FILE keyword must be specified. If both keywords are specified only the PATH keyword will be processed.
Required
GET ------- ENTRY --------- *READ ----------------------------->
*LIST
Optional
>-- PATH ---------- *ALL ------------------------------>
file path
>-- FILE ---------- file path ------------------------->
>-- BASE ---------- *NONE ----------------------------->
*CURRENT
path
>-- OCCURRENCE------ *ALL ----------------------------->
*FIRST
>-- TO ------------ path ------------------------------|
Keywords
ENTRY |
Specifies the type of operation performed by the GET command. The possible values are: The default value *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. A value of *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). |
PATH |
The PATH 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 PATH value is compared against the full path of the zip file entries to select those that are to be extracted. Specify either the PATH or FILE keywords. If you specify both only the PATH keyword will be processed. |
FILE |
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. The FILE keyword specifies the full path of a single entry in the zip archive that is to be extracted. Specify either the PATH or FILE keywords. If you specify both only the PATH keyword will be processed. |
BASE |
The BASE 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. The BASE keyword specifies whether path information in the zip file entries is used when extracting the files to the directory specified by the TO keyword. The possible values for the BASE keyword are: The default value *NONE indicates 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. *CURRENT indicates the path stored in the zip file entry is disregarded and all files are extracted to the directory specified by the TO keyword. 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. |
OCCURRENCE |
The OCCURRENCE keyword only applies when ENTRY(*READ) and FILE keyword are specified. By default all occurrences of a file are written out. If you only require the first or only occurrence of the file to be written out, then use the keyword value *FIRST. Using an occurrence value of *FIRST improves the access time to read a single file from the archive. |
TO |
The TO 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. |
Examples
RDML
This example extracts the entire contents of the current archive to the folder /EXTRACT:
CHANGE FIELD(#JSMCMD) TO('GET ENTRY(*READ) TO(/EXTRACT)')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)
RDMLX
This example extracts the entire contents of the current archive to the folder specified by #edtExtractFolder.Value:
#jsmcmd := 'get entry(*read) to(' + #edtExtractFolder.Value + ') base(' + #cboExtBas.Value + ')'
use builtin(jsmx_command) with_args(#jsmxhdle1 #jsmcmd) to_get(#jsmsts #jsmmsg)