The BS2ZIP application enables ZIP containers to be created on BS2000 systems, and files to be added to and extracted from these containers. The ZIP compression used is the Zlib method.
This application is also able to read ZIP containers built on open systems (Windows, Unix systems, Linux) provided they use the Zlib compression method and provided they are compliant with PKZIP 4.5 or GZIP.
The containers created in BS2000 can also be reopened on open systems if they were created in WinZip compatible format.
The command to start the BS2ZIP application is /START-ZIP-MANAGER or /START-ZIP.
After starting the application, the user has to open an existing container or to create a new one with the OPEN-ZIP-CONTAINER statement. In the case of the creation of a new container the user has to select the appropriate container format (operand FORMAT of the statement) according to the usage planned for the container to be created.
Please respect the following rules to select the appropriate format:
Container creation :
if you plan to use the container on BS2000 platforms only, you can create it in BS2000 format. Also, if you zip SAM or ISAM file including special print control characters, use the BS2000 format.
if you plan to export the container on open systems, create your container in *WINZIP compatible format (default one) only.
Container open :
you don’ t need to specify the container format at open of an existing container. The program finds itself the container format. However, if you specify the format, it must be the real format of the container otherwise the OPEN-ZIP-CONTAINER statement is rejected. Once, the container is opened, you can add or extract files.
The following table summarizes the default behavior of the BS2ZIP application for the different file types according to the container open format:
ZIP Format | File Access | |||||
SAM | ISAM | PAM/PLAM | ||||
WINZIP compatible | A: | Data only are saved | A: | Data and keys are saved | A: | Binary save without any conversion |
X: | Files are extracted with same organization than the original file. | X: | Files are extracted with same organization than the original file. | X: | Files are extracted with same organization than the original file. | |
BS2000 | A: | Record length saved with data | A: | Record length saved with data | A: | Binary save |
X: | Files are extracted with same organization than the original file. | X: | Files are extracted with same organization than the original file. | X: | Files are extracted with same organization than the original file. |
A: Add
X: Extract
Using the ADD-FILE and EXTRACT-FILE statements you can modify this default behavior. See those statements for details.
Note
Here and everywhere else in this document, where UTF16 is mentioned, UTF16 big endian is implied. Little endian variant of UTF16 is not supported as it is not supported by XHCS. When files in UTF16 are added/extracted to/from archives, BS2ZIP does not add BOM if it is absent in the file and it does not remove it if it present.
There are 3 types of CCSNAMEs in BS2ZIP: EBCDIC, ASCII and Unicode (see table below). ADD-FILE and EXTRACT-FILE commands have the option CHARACTER-CONVERSION to explicitly specify what type of conversion is required. During execution of the ADD-FILE command BS2ZIP preserves CCSNAME of an original file by putting it into the file-info (file comment that preserves the original file attributes), and it saves the current encoding of the file inside of the extensible data field. It helps EXTRACT-FILE to use CHARACTER-CONVERSION to determine what kind of conversion is needed to restore the file. By default, EXTRACT-FILE restores the original file encoding; but CHARACTER-CONVERSION also allows to force the output file to be in ASCII or EBCDIC or to force no conversions during the extractions. Unicode types are not converted during ADD-FILE or EXTRACT-FILE unless CHARACTER-CONVERSION = *BY-PARAMETERS is used.
EBCDIC | ASCII | Unicode |
---|---|---|
EDF03IRV EDF03DRV EDF04DRV EDF041 EDF042 EDF043 EDF044 EDF045 EDF046 EDF047 EDF049 EDF04A EDF04B EDF04C EDF04D EDF04E EDF04F EEHCL2 EEHCLC EEHCLC1 EEHCLAA EEHCLG | ISO88591 ISO88592 ISO88593 ISO88594 ISO88595 ISO88597 ISO88599 ISO8859F WCP1252P | UTF8 UTFE UTF16 |
Files added by BS2ZIP always have comments starting with "*BS2:" and containing the original BS2000 file attributes. If this comment is missing, BS2ZIP assumes that the file comes from a non-BS2000 system. By default, BS2ZIP now scans the first 32 kB of the file before extracting to determine its encoding (it distinguishes between ISO8859F, WCP1252, UTF8 and UTF16). To suppress this step, use the operand CHARACTER-CONVERSION=*TO-EBCDIC (file is converted from ISO8859F to EDF04F) / *TO-WIN-ANSI (file is converted from EDF04F to ISO8859F) / *BY-PARAMETERS (input and output encodings are specified manually).
Alternatively, operand WRITE-MODE allows to skip this scan for the extracted foreign text file. If WRITE-MODE = *REPLACE-ONLY or WRITE-MODE = *ANY is specified, then BS2ZIP can write the extracted file from archive to an existing file preserving its CODED-CHARACTER-SET attribute. Type of character conversion is inferred from this CODED-CHARACTER-SET attribute and CHARACTER-CONVERSION operand value.
In the case of file added to WinZip compatible container prior to version V21.0B10 CRLF (0D0A) always indicates the end of a data record, while starting from version V21.0B10 line delimiter is picked in accordance to the encoding of the file (000D000A for UTF16, 0D25 for EBCDIC, 0D0A for the rest). The original file may contain 0D0A or 0A represented in corresponding encoding, otherwise the file is spoiled when it is extracted. A WinZip compatible container should not contain any non-printable SAM or ISAM files.
ADD-FILE
CHARACTER CONVERSION | Meaning |
*BY-CONTAINER-FORMAT | Default value. Behavior determined by the ZIP container open format |
*NO | No conversion is forced |
*TO-EBCDIC | EBCDIC conversion is performed (only for SAM/ISAM files in ASCII encoding) |
*TO-WIN-ANSI | WIN-ANSI conversion is performed (only for SAM/ISAM files in EBCDIC encoding) |
EXTRACT-FILE
The open format determined by ZIP container format can be modified at EXTRACT-FILE time:
DATA-TYPE | Container format | |
WINZIP-COMPATIBLE | BS2000 | |
*NOT-SPECIFIED | If no file-info found in ZIP container | If no file-info found |
*CHARACTER | File is extracted as a SAM file | Statement rejected |
*BINARY | File is extracted as a PAM file | Statement rejected |
*SAM-BINARY | File is extracted as a SAM file, REC-FORM=U | Statement rejected |
CHARACTER- CONVERSION | Meaning |
*BY-CONTAINER-FORMAT | Default value. Behavior determined by the ZIP container open format |
*NO | No conversion is forced |
TO-WIN-ANSI | WIN-ANSI conversion is forced (only for extraction to SAM/ISAM file) |
*TO-EBCDIC | EBCDIC conversion is forced (only for extraction to SAM/ISAM file) |
*BY-PARAMETERS(...) | Conversion will be made according to specified source and target character sets (only for extraction to SAM/ISAM file) |
FROM-CCS | Origin coded character set, from which all characters will be converted. |
TO-CCS=*STD | Target coded character set is picked by finding the first fully compatible coded character set in EBCDIC of the same ISO code variant number as origin coded character set. If origin coded character set is Unicode, than no conversion is performed. (ISO code variant number, see manual XHCS [5]). |
TO-CCS | Target coded character set, to which all characters will be converted. |
Block format when extracting to various disk formats
When extracting a file, BS2ZIP takes into account the disk format in which the file is stored, the block format (BLOCK-CONTROL-INFO) of the original file which is stored in the archive, and the specification in the BLOCK-CONTROL-INFO operand which controls whether the block format must be retained. As a result of this, in some cases the file cannot be extracted, or a block format which differs from that of the original file must be selected.
Extracting to K disks
The extracted files contain the block format of the original file.
Extracting to NK2 disks
Files with the PAMKEY block format cannot be extracted using the BLOCK-CONTROL= *KEEP option.
Depending on the archive format, the BLOCK-CONTROL=*IGNORE option is used to set the block format as follows:
Properties of the original file | Specification in the BLOCK-CONTROL operand | ||||
(BS2000 format) | (WINZIP-COMPATIBLE format) | ||||
FCB type | BLK-CTRL | *KEEP | *IGNORE | *KEEP | *IGNORE |
PAM | PAMKEY | Not extracted | NO | Not extracted | NO |
PAM | DATA | Like original | Like original | Like original | Like original |
PAM | NO | Like original | Like original | Like original | Like original |
SAM | PAMKEY | Not extracted | DATA | Not extracted | DATA |
SAM | DATA | Like original | Like original | Like original | Like original |
ISAM | PAMKEY | Not extracted | DATA2K | Not extracted | DATA2K |
ISAM | DATA | Like original | Like original | Like original | Like original |