#### XML

#### Synopsis

    HELP:   Write XML data to a file
    TYPE:   OBJECT
    SYNTAX: XML(NET.{},FILE='str'/STREAM/DUMMY,FALLOC(),REMOVE,REMAIN,APPEND,FLUSH,METHOD.{},CCSID='str'/DEFAULT/ASCII/EBCDIC/SYSTEM/LOCAL,BOM,KEPBOM,ELF2NL,CHRMODE=STOP/IGNORE/SUBSTITUTE/IDENTITY/TRANSLIT,SUBCHAR[num/SYSTEM...],SYSTABLE=ICONV,USRTABLE='str'/NPAS/SEPA/DELA/DLAX,ONEMAP,COMBINED=NFD/NFC/AUTO/ON/OFF,REPORTFILE='str'/STDOUT/STDERR,COMPRESS.{},ENCRYPT/ENC.{},ENCODE/COD.{},ARCHIVE/LIB.{},FRCREC,LANG='str',PLATFORM=WIN/UNX/ZOS/USS/VSE/BS2/MAC,OWNER='str',ENVID='str',HASH(),SIGNATURE.{},NOMKDIR,ATTRIB(),AVSCAN(),PREPROCESS[()...],POSTPROCESS/PSTPRO[()...])

#### Description

Write XML formats FLAM elements containing parsed XML data. The output is a valid XML document. The output XML can be formatted using 3 different methods:

- STANDARD: The XML document is reconstructed as close to the original XML document as possible.
- PRETTYPRINT: Creates an XML document with indentation suitable for human readability.
- MINIMIZED: Creates a minimized XML document. Line breaks and whitespace are removed unless they are part of actual character data.

The XML output is written in blocks and encoded in UTF-8 with line feed (0xA) as line delimiter unless a CCSID is supplied, in which case character conversion is performed.

If writing XML, the semantics of read modes (read.*()) change as follows:

- BINARY: The binary input data is assumed to be a valid XML document encoded in UTF-8. It is parsed and then written according to the selected write options.
- CHARACTER: The input data is assumed to be a valid XML document. The input is converted to UTF-8 before it is passed to the XML parser. The parsed XML data is then written according to the selected write options.
- TEXT: The input data is assumed to be a valid XML document. The input is converted to UTF-8 before it is passed to the XML parser. The parsed XML data is then written according to the selected write options.
- XML: The input data is a valid XML document. If a CCSID is supplied, the input is converted to UTF-8 prior to parsing. If no CCSID is given, then UTF-8 is assumed.
- RECORD: The input records are converted to UTF-8, line delimiters added after each record and converted into binary blocks before the input is passed to the XML parser. The parsed XML data is then written according to the selected write options.
- FLAM4: Same as RECORD, but read from a FLAM4 file.

For compression, encryption, encoding and archiving, one of the supported methods can be used. For each of these methods, specific parameters can be set to control the conversions. The output file can be written to a local or remote system.

#### Arguments

- `STRING: FILE='str'/STREAM/DUMMY - Name/URL of file to write [''==origin.ext]`
  - `STREAM - Read from stdin or write to stdout`
  - `DUMMY - Read EOF or write nothing`
- `SWITCH: REMAIN - Remain existing files (don't overwrite) [FALSE]`
- `SWITCH: APPEND - Append data to this file or add member to archive [FALSE]`
- `SWITCH: FLUSH - Enforce flush in front of close file [FALSE]`
- `SWITCH: KEPBOM - Keep byte order mark for faster conversion`
- `SWITCH: FRCREC - Enforce record orientation on record oriented devices [FALSE]`
- `SWITCH: NOMKDIR - Don't create path if path not exists [FALSE]`