HELP: Write records to a file
TYPE: OBJECT
SYNTAX: RECORD(NET.{},FILE='str'/STREAM/DUMMY,FIOMODE=STOP/APPEND/OVERWRITE,EMPTYFILE=INFO/WARNING/ERROR/DELETE,FALLOC(),REMOVE,RENAME='str',REMAIN,APPEND,FLUSH,RECMODE=STOP/CUT/WRAP/SKIP,RECFORMAT=NONE/BIN/TXT/TXT-ASA/TXT-MCC/DLM/DLM-ASA/DLM-MCC/VAR/VAR-ASA/VAR-MCC/FIX/FIX-ASA/FIX-MCC/VAR-REL/VAR-REL-ASA/VAR-REL-MCC/FIX-REL/FIX-REL-ASA/FIX-REL-MCC/F/FA/FM/FS/FSA/FSM/FB/FBA/FBM/FBS/FBSA/FBSM/FE/FEA/FEM/FK/FKA/FKM/FR/FRA/FRM/U/UA/UM/V/VA/VM/VS/VSA/VSM/VB/VBA/VBM/VBS/VBSA/VBSM/VE/VEA/VEM/VK/VKA/VKM/VR/VRA/VRM/ORG,RECLENGTH=num,RECDELIM='bin'/CR-ASCII/LF-ASCII/NL-ASCII/CRLF-ASCII/CR-EBCDIC/LF-EBCDIC/NL-EBCDIC/CRLF-EBCDIC/CR-UTF08/LF-UTF08/NL-UTF08/CRLF-UTF08/CR-UTF16BE/LF-UTF16BE/NL-UTF16BE/CRLF-UTF16BE/CR-UTF16LE/LF-UTF16LE/NL-UTF16LE/CRLF-UTF16LE/CR-UTF32BE/LF-UTF32BE/NL-UTF32BE/CRLF-UTF32BE/CR-UTF32LE/LF-UTF32LE/NL-UTF32LE/CRLF-UTF32LE,LENFORMAT.{},PRNCONTROL=DETACH/RETAIN/ERASE/REPLACE,RPLFFD[=num],SUPPADDING,PADCHAR='bin'/BINARY-ZERO/ASCII-BLANK/EBCDIC-BLANK/UTF08-BLANK/UTF16BE-BLANK/UTF16LE-BLANK/UTF32BE-BLANK/UTF32LE-BLANK,NOSPANNED,ADDEXT='str',CCSID='str'/DEFAULT/ASCII/EBCDIC/SYSTEM/LOCAL,CASE=UPPER/LOWER/FOLD/SUPPER/SLOWER/USRTAB,BOM,KEPBOM,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,BLK2REC,REGEXP(),COMPRESS/CMP.{},ENCRYPT/ENC.{},ENCODE/COD.{},ARCHIVE/LIB.{},LANG='str',PLATFORM=WIN/UNX/ZOS/ZOS31/ZOS64/USS/USS31/USS64/VSE/BS2/MAC,OWNER='str',ENVID='str',HASH(),SIGNATURE.{},INDSIZ=num,INDCHR=SPACE/TABULATOR,NOCMNT,NOMKDIR,TABLE(),COMMENT(),ATTRIB(),AVSCAN(),PREPROCESS[()...],POSTPROCESS/PSTPRO[()...])
Write record formats the list of elements as records for host data set formats or to archive the dataset in a format like GZIP, ZIP, PGP or as a FLAMFILE on a local or remote system.
The following options are supported:
If a record is marked as text record, character conversion from UTF-8 to a defined CCSID is done.
The following options are supported for character conversion:
During record I/O, encryption and compression can be applied. When selecting output formats like GZIP, PGP or ZIP, records are converted to data blocks. By default, a record length field (L4X) is put in front of binary records. For text records, a text delimiter is add by default. You can also specify a binary delimiter or another kind of 4 byte length field. The default text record conversion to a data block is compatible with a text file on non-mainframe platforms.
RECFORMAT and RECLENGTH at this object describe the LOGICAL side: how the data is cut into records before it is handed to the file layer. The same two parameters inside FALLOC() describe the PHYSICAL side: how the file or data set is created. Both lengths are net -- data only, without print control characters and without length fields.
write.record(file='DD:OUTPUT' recformat=TXT falloc(recf=FB recl=80))
writes text records with their delimiter into a data set described as FB80, while
write.record(file='DD:OUTPUT' recformat=FIX reclength=80)
writes fixed records of 80 bytes into a statically allocated data set, where there is no allocation to describe at all. Giving only the FALLOC() pair is the spelling of every release before 5.2.1 and keeps working unchanged. The FALLOC() manual page lists the merge rules and the combinations that are refused.
RECMODE says what happens to a record that does not fit into RECLENGTH. With RECDELIM the record has to be assembled in a buffer before it is written, so the mode is applied first: SKIP drops the record, and CUT shortens it so that the delimiter still fits into the record. WRAP has no answer that works from a buffered copy, and the default STOP has none either -- both are refused with a message naming the lengths. Without RECDELIM, a key disposition or retained print control no buffer is involved and every record mode works for any record length.
If you chose to retain control characters, then all record attributes (slot number, ASA and MCC) are stored in front the a binary record. If text handling used, then ASA and machine control character are lost, except the print control at READ.RECORD() was retain, in which case character conversion does not make much sense.
The file attributes can only be stored in a FLAMFILE, GZIP or ZIP member header or if an ASCII armor header is used. If you create, for example, a BZIP2 or binary PGP file, then all the DCB parameter are lost. When reading the file back, a PS-VB dataset will be created by default. The combinations below produce an archive that allow restoring the host data set without losing meta data (except load module entry addresses of a PDS(E) load library):
read.record(...) write.record(... archive.fl4()) read.record(...) write.record(... archive.zip()) read.record(...) write.record(... comp.bzip() archive.zip()) read.record(...) write.record(... encr.pgp() archive.zip()) read.record(...) write.record(... comp.gzip() encr.pgp()) read.record(...) write.record(... encr.pgp(armor())) read.record(...) write.record(... comp.bzip() encode.armor())
This functionality uses a private extension field in GZIP, ZIP or ARMOR headers and a per-record length field in the data. You can also use a binary delimiter for variable length records. When archiving files with FLCL, you must read them with FLCL to restore the datasets correctly. To read such a file, the example below can be used:
read.record(file='infile' DECODE) write.record()
Write record supports different encoding schemes (e.g. Base64). By default, the encoding is done record by record. If you enforce block orientation for the encoding, the record boundaries are lost and the resulting blocks can wrapped to new records, if you define all the corresponding parameters accordingly. When writing archive formats, the encoding is done after all compression/encryption.
If the data to be written consists of table elements and the 'TABLE' object is not specified or with no further formatting (i.e. TABLE()), then the original record in system representation without header 'TABLE(FORMAT=ORG DEFAULTS(SYSTEM,NOHDLN))' is written. Character conversion is done on a per-element basis. There is no report file or BOM support if table formatting is used. Use the 'TABLE' object to reformat the table.
STRING: FILE='str'/STREAM/DUMMY - Name/URL of file to write [''==origin.ext]
STREAM - Read from stdin or write to stdoutDUMMY - Read EOF or write nothingNUMBER: FIOMODE=STOP/APPEND/OVERWRITE - Error handling if the same file is used again [APPEND]
STOP - Stop processing with an errorAPPEND - Add the new data to the existing file or memberOVERWRITE - Overwrite the existing file or memberNUMBER: EMPTYFILE=INFO/WARNING/ERROR/DELETE - Define special handling for empty files [NONE]
INFO - Print info to the logWARNING - Print warning to the log (completion code 1)ERROR - Stop procession with error and special completion codeDELETE - Delete the empty file (nothing written)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]NUMBER: RECMODE=STOP/CUT/WRAP/SKIP - Mode used to write records [STOP]
STOP - Stop if record too longCUT - Cut if record too longWRAP - Wrap if record too longSKIP - Skip if record too longNUMBER: RECFORMAT=NONE/BIN/TXT/TXT-ASA/TXT-MCC/DLM/DLM-ASA/DLM-MCC/VAR/VAR-ASA/VAR-MCC/FIX/FIX-ASA/FIX-MCC/VAR-REL/VAR-REL-ASA/VAR-REL-MCC/FIX-REL/FIX-REL-ASA/FIX-REL-MCC/F/FA/FM/FS/FSA/FSM/FB/FBA/FBM/FBS/FBSA/FBSM/FE/FEA/FEM/FK/FKA/FKM/FR/FRA/FRM/U/UA/UM/V/VA/VM/VS/VSA/VSM/VB/VBA/VBM/VBS/VBSA/VBSM/VE/VEA/VEM/VK/VKA/VKM/VR/VRA/VRM/ORG - Logical record format of the data to write [physical format or original]
NONE - No format definedBIN - Open - Binary (undefined) data (only the last record are shorter then record length)TXT - Open - Text data with standard delimiter (result is a stripped variable length records)TXT-ASA - Open - Text data with standard delimiter and ASA byte in front (result variable length records with ASA attribute)TXT-MCC - Open - Text data with standard delimiter and MCC byte in front (result variable length records with MCC attribute)DLM - Open - Records separated by a special delimiter with the result of variable length recordsDLM-ASA - Open - ASA records separated by a special delimiter with the result of variable length recordsDLM-MCC - Open - MCC records separated by a special delimiter with the result of variable length recordsVAR - Open - Variable length record (if necessary define length format)VAR-ASA - Open - Variable length record with ASA print control character (if necessary define length format)VAR-MCC - Open - Variable length record with machine print control codes (if necessary define length format)FIX - Open - Fixed-length record (file size = N * record length)FIX-ASA - Open - Fixed-length record with ASA print control character (file size = N * (record length + 1))FIX-MCC - Open - Fixed-length record with machine print control codes (file size = N * (record length + 1))VAR-REL - Open - Variable relative record (if necessary define length format)VAR-REL-ASA - Open - Variable relative record with ASA print control character (if necessary define length format)VAR-REL-MCC - Open - Variable relative record with machine print control codes (if necessary define length format)FIX-REL - Open - Fix relative record (file size = N * (record length + 8))FIX-REL-ASA - Open - Fix relative record with ASA print control character (file size = N * (record length + 9))FIX-REL-MCC - Open - Fix relative record with machine print control codes (file size = N * (record length + 9))F - Host - Fixed-length, unblockedFA - Host - Fixed-length, unblocked, ASA print control charactersFM - Host - Fixed-length, unblocked, machine print control codesFS - Host - Fixed-length, standardFSA - Host - Fixed-length, standard, ASA print control charactersFSM - Host - Fixed-length, standard, machine print control codesFB - Host - Fixed-length, blockedFBA - Host - Fixed-length, blocked, ASA print control charactersFBM - Host - Fixed-length, blocked, machine print control codesFBS - Host - Fixed-length, blocked, standardFBSA - Host - Fixed-length, blocked, standard, ASA print control charactersFBSM - Host - Fixed-length, blocked, standard, machine print control codesFE - Host - Fixed-length, ESDSFEA - Host - Fixed-length, ESDS, ASA print control charactersFEM - Host - Fixed-length, ESDS, machine print control codesFK - Host - Fixed-length, KSDSFKA - Host - Fixed-length, KSDS, ASA print control charactersFKM - Host - Fixed-length, KSDS, machine print control codesFR - Host - Fixed-length, RRDSFRA - Host - Fixed-length, RRDS, ASA print control charactersFRM - Host - Fixed-length, RRDS, machine print control codesU - Host - Undefined-lengthUA - Host - Undefined-length, ASA print control charactersUM - Host - Undefined-length, machine print control codesV - Host - VariableVA - Host - Variable, ASA print control charactersVM - Host - Variable, machine print control codesVS - Host - Variable, spannedVSA - Host - Variable, spanned, ASA print control charactersVSM - Host - Variable, spanned, machine print control codesVB - Host - Variable, blockedVBA - Host - Variable, blocked, ASA print control charactersVBM - Host - Variable, blocked, machine print control codesVBS - Host - Variable, blocked, spannedVBSA - Host - Variable, blocked, spanned, ASA print control charactersVBSM - Host - Variable, blocked, spanned, machine print control codesVE - Host - Variable, ESDSVEA - Host - Variable, ESDS, ASA print control charactersVEM - Host - Variable, ESDS, machine print control codesVK - Host - Variable, KSDSVKA - Host - Variable, KSDS, ASA print control charactersVKM - Host - Variable, KSDS, machine print control codesVR - Host - Variable, RRDSVRA - Host - Variable, RRDS, ASA print control charactersVRM - Host - Variable, RRDS, machine print control codesORG - Use original record format as default (like none)NUMBER: RECLENGTH=num - Logical record length, net (no print control, no length fields) [physical length or original]STRING: RECDELIM='bin'/CR-ASCII/LF-ASCII/NL-ASCII/CRLF-ASCII/CR-EBCDIC/LF-EBCDIC/NL-EBCDIC/CRLF-EBCDIC/CR-UTF08/LF-UTF08/NL-UTF08/CRLF-UTF08/CR-UTF16BE/LF-UTF16BE/NL-UTF16BE/CRLF-UTF16BE/CR-UTF16LE/LF-UTF16LE/NL-UTF16LE/CRLF-UTF16LE/CR-UTF32BE/LF-UTF32BE/NL-UTF32BE/CRLF-UTF32BE/CR-UTF32LE/LF-UTF32LE/NL-UTF32LE/CRLF-UTF32LE - Delimiter used to define end of record
CR-ASCII - Delimiter: carriage return in ASCII (0x0D)LF-ASCII - Delimiter: line feed in ASCII (0x0A)NL-ASCII - Delimiter: new line in ASCII (0x85)CRLF-ASCII - Delimiter: carriage return line feed in ASCII (0x0D0A)CR-EBCDIC - Delimiter: carriage return in EBCDIC (0x0D)LF-EBCDIC - Delimiter: line feed in EBCDIC (0x25)NL-EBCDIC - Delimiter: new line in EBCDIC (0x15)CRLF-EBCDIC - Delimiter: carriage return line feed in EBCDIC (0x0D25)CR-UTF08 - Delimiter: carriage return in UTF-8 (0x0D)LF-UTF08 - Delimiter: line feed in UTF-8 (0x0A)NL-UTF08 - Delimiter: new line in UTF-8 (0xC285)CRLF-UTF08 - Delimiter: carriage return line feed in UTF-8 (0x0D0A)CR-UTF16BE - Delimiter: carriage return in UTF-16BE (0x000D)LF-UTF16BE - Delimiter: line feed in UTF-16BE (0x000A)NL-UTF16BE - Delimiter: new line in UTF-16BE (0x0085)CRLF-UTF16BE - Delimiter: carriage return line feed in UTF-16BE (0x000D000A)CR-UTF16LE - Delimiter: carriage return in UTF-16LE (0x0D00)LF-UTF16LE - Delimiter: line feed in UTF-16LE (0x0A00)NL-UTF16LE - Delimiter: new line in UTF-16LE (0x8500)CRLF-UTF16LE - Delimiter: carriage return line feed in UTF-16LE (0x0D000A00)CR-UTF32BE - Delimiter: carriage return in UTF-32BE (0x0000000D)LF-UTF32BE - Delimiter: line feed in UTF-32BE (0x0000000A)NL-UTF32BE - Delimiter: new line in UTF-32BE (0x00000085)CRLF-UTF32BE - Delimiter: carriage return line feed in UTF-32BE (0x0000000D0000000A)CR-UTF32LE - Delimiter: carriage return in UTF-32LE (0x0D000000)LF-UTF32LE - Delimiter: line feed in UTF-32LE (0x0A000000)NL-UTF32LE - Delimiter: new line in UTF-32LE (0x85000000)CRLF-UTF32LE - Delimiter: carriage return line feed in UTF-32LE (0x0D0000000A000000)NUMBER: RPLFFD=num - Replace form feeds, filling rest of page with empty records assuming n lines per page [60]SWITCH: SUPPADDING - Suppress trailing padding characters (useful for variable records)STRING: PADCHAR='bin'/BINARY-ZERO/ASCII-BLANK/EBCDIC-BLANK/UTF08-BLANK/UTF16BE-BLANK/UTF16LE-BLANK/UTF32BE-BLANK/UTF32LE-BLANK - Character to pad records to a fixed length [system] or used for empty variable length records [NONE]
BINARY-ZERO - Padding with 0x00ASCII-BLANK - Padding with 0x20EBCDIC-BLANK - Padding with 0x40UTF08-BLANK - Padding with 0x20UTF16BE-BLANK - Padding with 0x0020UTF16LE-BLANK - Padding with 0x2000UTF32BE-BLANK - Padding with 0x00000020UTF32LE-BLANK - Padding with 0x20000000SWITCH: NOSPANNED - Deactivate write of large spanned records to V(B)S datasets [FALSE]SWITCH: KEPBOM - Keep byte order mark for faster conversionSWITCH: BLK2REC - Convert block with delimiter to records (including suppression of trailing whitespaceNUMBER: INDSIZ=num - Number of XML indentation characters per indentation level [2 (SPACE) or 1 (TAB)]NUMBER: INDCHR=SPACE/TABULATOR - Indentation character used to indent XML tags [SPACE]
SPACE - Use the space character as indentation characterTABULATOR - Use the tabulator character as indentation characterSWITCH: NOCMNT - Do not write out XML comments [FALSE]SWITCH: NOMKDIR - Don't create path if path not exists [FALSE]