REC

Synopsis

HELP:   Read a file record-oriented (mainly for mainframe world)
TYPE:   OBJECT
SYNTAX: REC(NET.{},NAME/FILE['str'/STREAM/DUMMY...],EXCLUDE['str'...],RECMOD=STOP/CUT/WRAP/SKIP,PRNCTR=DETACH/RETAIN/ERASE/REPLACE,RPLFFD[=num],SUPPAD,PADCHR='bin'/BINARY-ZERO/ASCII-BLANK/EBCDIC-BLANK/UTF08-BLANK/UTF16BE-BLANK/UTF16LE-BLANK/UTF32BE-BLANK/UTF32LE-BLANK,FILORG=SEQ/PS/LIB/PDS/USS/EDS/ESDS/KDS/KSDS/RDS/RRDS,BLKSIZ=num,RECFMT=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,RECLEN=num,RECCNT=num,LENFMT.{},CHRSET=NONE/SYSTEM/ASCII/UCS1/UTF8/EBCDIC/UCS2BE/UTF16BE/UCS2LE/UTF16LE/UCS4BE/UTF32BE/UCS4LE/UTF32LE/LOCAL,RECDLM='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,KEYPOS=num,KEYLEN=num,SUBSYS(),REMOVE,RENAME='str',NOSPAN,PREPRO[()...],POSTPRO/PSTPRO[()...],PARSEEXT)

Description

This object defines the record-oriented read operation for files. This method reads records from a data set. You can define the record length and the behavior (STOP/CUT/WRAP) if the record is longer than the defined record length. You can activate the suppression of padding characters and set the padding character. You can define the file organization, block size, record format and a lot of other parameters (see below).

The record length is always the real data length after all deductions. For example, for a FBA with a LRECL of 121, the record length of FLAM is 120 because the print control character is normally an attribute and not a part of the record.

On record oriented systems (mainly mainframes), a lot of these parameters are known from the catalog and need not be defined. On other platforms (Windows, Unix, ...), catalogs do not exist. On such systems, you must specify how the record-oriented file was written (record format, length format).

FLAM supports some record formats on mainframes which are not supported by the corresponding catalog system. For example, record formats with print control characters for VSAM data sets are supported by FLAM. If you know your data in a KSDS has a print control character in the first byte, you can choose the corresponding record format (VKA/VKM) to DETACH the print control character as attribute from the record.

The record I/O component also supports text files with delimiters. The record format text can be used to parse records form a delimiter-based text file, for which you can define the character set. It is also possible to parse binary data into records based on a custom delimiter. For this, the record format DLM can be used. The record format BIN simply wraps the data into records of the provided record length. The final record may be shorter. With the 'FIX' record format, the last record also has the provided record length. For variable length record formats (VAR) on non-record-oriented systems, the length format must be defined. All these formats are supported to transfer data between record-oriented and block-oriented systems.

For USS on z/OS the default length format for variable records conforms to SVC99 allocation with FILEDATA=RECORD. The record format TXT works like FILEDATA=TEXT if default settings used.

Filename-embedded record format qualifiers (AUTODET)

On open platforms (non-MVS) FLAM detects record format information embedded in the filename base before opening the file. A qualifier is a dot-or-underscore-delimited token in the filename:

  [._]<qualifier>[._]

When a qualifier is recognized the corresponding parameters are applied automatically without requiring explicit read.record() options. Three INFO-level diagnostic messages are emitted:

  FIOREC-OPNR : AUTODET: record format 0x... applied from filename qualifier '...'
  FIOREC-OPNR : AUTODET: record length N applied from filename qualifier '...'
  FIOREC-OPNR : AUTODET: delimiter 0x.. applied from filename qualifier '...'

FIX and VAR/U qualifiers emit the record format and record length messages. DLM qualifiers emit the record format and delimiter messages. LFM qualifiers set only the length-field format.

FIX group (LRECL mandatory in qualifier)

The qualifier digit is always the net (user-visible) record length, without overhead bytes (ASA/MCC control character, RRDS slot number). The physical (file) record length equals the net length plus the format adjustment (adj):

  Qualifier    Token   Adj  Example    Net data  Physical LRECL
  .F<n>.       F       0    .F80.      80        80
  .FB<n>.      FB      0    .FB80.     80        80
  .FBA<n>.     FBA     1    .FBA80.    80        81 (80 data + 1 ASA)
  .FBM<n>.     FBM     1    .FBM80.    80        81 (80 data + 1 MCC)
  .FBS<n>.     FBS     0    .FBS80.    80        80
  .FBSA<n>.    FBSA    1    .FBSA80.   80        81
  .FBSM<n>.    FBSM    1    .FBSM80.   80        81
  .FR<n>.      FR      8    .FR80.     80        88 (80 data + 8 RRDS)
  .FRA<n>.     FRA     9    .FRA80.    80        89 (80 data + 8 RRDS + 1 ASA)
  .FRM<n>.     FRM     9    .FRM80.    80        89

Additional FIX tokens: FA, FM, FE, FEA, FEM, FK, FKA, FKM, FL, FLA, FLM, FS, FSA, FSM (same pattern; adj=1 for ASA/MCC suffixes, adj=8 or adj=9 for RRDS variants).

VAR/U group (LRECL optional)

The qualifier digit is the net maximum record length (MAXLRECL without overhead). The physical per-record size is the net MAXLRECL plus the format adjustment. The qualifier value may be omitted:

  .VB.        VB, no net MAXLRECL specified
  .VB4096.    VB with net MAXLRECL=4096 (physical LRECL=4096)
  .VBA4096.   VBA (ASA) with net MAXLRECL=4096 (physical LRECL=4097)
  .U.         Unstructured
  .U512.      Unstructured with net MAXLRECL=512

Additional VAR/U tokens: V, VA, VM, VBS, VBSA, VBSM, VS, VSA, VSM, VE, VEA, VEM, VK, VKA, VKM, VL, VLA, VLM, VR, VRA, VRM, UA, UM.

DLM group (single-byte delimiter)

  .DLM0A.    delimiter byte 0x0A (LF, Unix newline)
  .DLM0D.    delimiter byte 0x0D (CR)
  .DLM25.    delimiter byte 0x25 (0x15 NEL in EBCDIC, '=' in ASCII)

LFM group (length-field format for VAR records)

LFM qualifiers encode the format of the binary length field prefixed to each variable-length record. They may appear alone or combined with a VAR/U qualifier:

  .LFM32B.      32-bit big-endian integer
  .LFM16LI.     16-bit little-endian integer, length field inclusive
  .LFM64S.      64-bit system-endian integer
  .LFMS4AD.     4-char ASCII decimal string
  .LFMS5EXI.    5-char EBCDIC hex string, inclusive
  .LFMB24.      24-bit BCD
  .LFMB32I.     32-bit BCD, inclusive
  .LFMH.        z/OS RDW (4-byte big-endian, inclusive)
  .LFMHE.       z/OS RDW, exclusive (value does not count header)

LFM syntax rules:

Combined example: .VB256.LFM32B. sets VB MAXLRECL=256 with 32-bit big-endian length prefix.

On z/OS MVS host datasets (names starting with a subsystem prefix ':') filename qualifiers are not applied because the catalog DCB attributes always take precedence.

Attributes (length, slot number of RRDS, print control character) are stored in front of each record on non-record-oriented systems. Example: If you read a RRDS with print control characters (FRA) and you write this on UNIX as record format VRA to a file, the file format looks like this:

    LLLLnnnnnnnnCdddd..dddd
    LLLLnnnnnnnnCdddd..dddd
    LLLLnnnnnnnnCdddd..dddd
    ...
    ...
    ...
    LLLLnnnnnnnnCdddd..dddd
    LLLLnnnnnnnnCdddd..dddd

Where LLLL is the record length, nn...nn is the slot number C is the print control character and dd..dd is the record data. To read such a file on a UNIX system, the record format and length format (if you write with defaults, you can read with defaults) must be defined correctly.

Limits on the record length and the record count

RECLENGTH and RECCOUNT together size the buffer the records are read into, so their product is bounded: above 1 GiB it is refused with a message naming both values instead of wrapping the size. A buffer beyond that cannot be expressed in the size arithmetic of the layers below.

Arguments