#### FL4

#### Synopsis

    HELP:   Write data to FLAM4FILE
    TYPE:   OBJECT
    SYNTAX: FL4/FLAM4(MEMBER='str',CMPMODE=CX7/CX8/VR8/ADC/NDC,ENCMODE=OFF/AES/FLAMENC,COMMENT='str',PASSWORD/CRYPTOKEY='bin'/DEFAULT,KMLIBRARY='str',KMFUNCTION='str',KMPARAMETER='bin',NOPATH)

#### Description

Stores the data in a FLAM version 4 archive. You can specify various compression and encryption parameters for the created FLAMFILE. If the input data is not compressible, it is automatically stored in the FLAM archive with MODE=NDC (no data compression) as compressing already compressed data does not make sense.

If the record-oriented writing method (write.record()) is used, the records, including all attributes, are written to the FLAM archive. If a block-oriented method (write.binary/char/text/xml()) is used, the data blocks are wrapped into records and written to the FLAMFILE as binary chunks with an undefined record format (U).

Since version 5.1.12, this object replaces the former FLAM4NDC switch, the FLAM4 object of the COMPRESS overlay (comp.flam4()) and the F4PWD/KME objects of the ENCRYPT overlay (encr.f4pwd() or encr.f4kme()).

Passwords can be provided in four different ways:

- In hexadecimal format (recommended): password=x'hex'
- In ASCII format: PASSWORD=a'ascii'
- In EBCDIC format: PASSWORD=e'ebcdic'
- In local charset: PASSWORD='system'

Don't use the local charset variant if you wish to open the file on different platforms.

To prevent passwords from being logged and for a better protection, we recommend to store passwords in files and use that password file instead passing the password directly.

       ARCHIVE.FL4(PASSWORD=f'pwd.txt'))

In a password file, you can define the password in one of the variants described above.

If the data is already compressed, then MODE=NDC (no data compression) is used. Otherwise, ADC compression is used. If you set the compression mode to CX7/CX8/VR8 then no encryption is possible.

If you use the FLAM4 key management extension (FKME). The FLAM data key is provided by an FKME module. The library name, function name and corresponding parameter list must be provided.

On mainframe systems, the load module name and the entry name must be identical, the load module must be in the STEPLIB concatenation and the library name is ignored. If only a function name is provided, then the default library name is "" on mainframes and "libfkme" on other platforms. If only a library name is provided, the default function name "FKMESTD0" is used.

If no FKME parameter is provided then FKMESTD0 from the default library (see above) is used. The default FKMESTD0 returns a hardcoded key as encryption key identical to the default password.

IMPORTANT: Encrypting using the default FKME is strongly discouraged in production as this equals using a publicly known password! The data is merely obfuscated.

You may define the encryption mode. The default and recommended mode is AES.

#### Arguments

- `STRING: MEMBER='str' - File name for header [from origin]`
- `NUMBER: CMPMODE=CX7/CX8/VR8/ADC/NDC - Compression mode [ADC]`
  - `CX7 - Compression encoding as printable characters`
  - `CX8 - Compression encoding as binary data`
  - `VR8 - Enhanced compression encoding as binary data`
  - `ADC - Advanced Data Compression`
  - `NDC - No data compression`
- `NUMBER: ENCMODE=OFF/AES/FLAMENC - Encryption mode [NONE]`
  - `OFF - Disable encryption`
  - `AES - AES encryption`
  - `FLAMENC - FLAM encryption`
- `STRING: COMMENT='str' - Comment for the member in the FLAMFILE [internal use]`
- `STRING: PASSWORD/CRYPTOKEY='bin'/DEFAULT - Passphrase to encrypt the FLAMFILE ['']`
  - `DEFAULT - FLAM4 default password`
- `STRING: KMLIBRARY='str' - Library name for FKME ['']`
- `STRING: KMFUNCTION='str' - Function name of FKME ['']`
- `STRING: KMPARAMETER='bin' - Parameter for the call of FKME ['']`
- `SWITCH: NOPATH - Exclude directory path of the original file in the compressed data [FALSE]`