ADD
The ADD command adds files, directories and child directories to the current archive (the archive last successfully opened using the CREATE or OPEN command) in the current instance of the ZipService.
Either the PATH or FILE keyword must be specified. If both keywords are specified only the PATH keyword will be processed.
Specify the folders or files to be added using either the PATH or FILE keywords. For each of these keywords you can specify a single folder or file, or you can provide a list of entries to be added.
Conditional
ADD -------- FILE ---------- file path ----------------------->
*LIST
>-- PATH ---------- file path ----------------------->
*LIST
Optional
>-- BASE ---------- *NONE --------------------------->
*CURRENT
*PARENT
path
>-- TREE ---------- *YES ----------------------------|
*NO
Keywords
FILE |
Specifies the path for one or more files to be added to the current archive. The file paths specified must refer to an existing file. Adding directories using this keyword is not supported. You can specify this keyword as either: File path specifies the name, and optionally the path, a single directory or file to be added to the current archive. The file path consists of the following parts: *LIST specifies a working list is provided with the command. This list includes the files, optionally with path information, to be added to the current archive. The working list must include one field to contain the path of the files to be added. Specify either the PATH or FILE keywords. If you specify both only the PATH keyword will be processed. |
PATH |
Specifies the paths for one or more directories or files to be added to the current archive. You can specify this keyword in one of two ways: File path specifies the path of a single directory or file to be added to the current archive. *LIST specifies a working list is provided with the command. This list includes the paths of one or more directories or files to be added to the current archive. The working list can have one or two fields. The first field is expected to contain the paths of the directories or files. An optional second field can be used to specify the BASE value (refer to <BASE>) that applies to the directory or file identified by the list entry. If the second field is not provided, or if it is provided but is blank, *NONE is assumed for the BASE value. If you specify relative paths the ZipService will look for the directories or files relative to the JSM instance directory. Specify either the PATH or FILE keywords. If you specify both only the PATH keyword will be processed. |
BASE |
The BASE keyword is used in conjunction with the PATH keyword. The BASE keyword controls how the path information is stored for each entry in the zip archive. By specifying an appropriate value for this keyword you can avoid the full path being stored for each zip entry – instead you can specify that the stored path should be relative to a common root path. This is useful when the contents of the zip archive are to be extracted on a system that has a different directory structure to the source machine If you populate the zip archive with more than one ADD command, you should take care to specify consistent and compatible values on each instance of the ADD command so as to ensure a consistent path structure in the resulting zip archive. The possible values for the BASE keyword are: The default value *NONE indicates the paths stored in the zip archive are not modified *CURRENT indicates the path stored in the zip file is relative to the directory containing the entries being added to the zip file. *PARENT indicates the path stored in the zip file is relative to the parent of the directory containing the entries being added to the zip file. Nominate a path to be used as the relative path for all files in the zip archive. |
TREE |
The TREE keyword is used in conjunction with the PATH keyword. The TREE keyword specifies whether the add operations should recursively traverse sub-directories of the directory(s) specified. The possible values for the TREE keyword are: *YES (default) the child directories of the specified directory(s) and their contents will be added to the current archive. If the child directories themselves contain further directories, those directories and their contents are also added, and so on until all the descendants of the specified directory(s) are added. *NO child directories and their contents are not added. |
Examples
RDML
This example adds a single file to the current archive. No path is specified so the ZipService will look for the file in the JSM instance directory.
USE BUILTIN(JSM_COMMAND) WITH_ARGS('ADD FILE(MYBIGTEXT.TXT)') TO_GET(#JSMSTS #JSMMSG)
RDMLX
This example adds all files in the specified path to the current archive with path information stored relative to the directory specified in the PATH keyword.
use builtin(jsmx_command) with_args(#jsmxhdle1 'add path(/send/orderdirectory) base(*parent)') to_get(#jsmxsts #jsmxmsg)