The record interface (access method) is based on the byte interface of FLUC. It allows sequential access in record form (length and data) to original data sets as is commonly used with file-I/O in the mainframe world (GET/PUT for COBOL or PL1). Local or remote access and all conversion options made available by FLAM can be used for reading and writing original data. For example, data sets encoded in EBCDIC IBM-1141 can be read transparently, even though the data comes from a member of a concatenated GZIP-file which is encrypted, Base64-encoded and located on a local disk or a remote system (Cloud/HOST/DMZ), with the actual plain text being encoded in UTF-16LE and delimited by 0x0D000A00.
The record interface is available for COBOL, PL1, C, Assembler and other programming languages in the form of separate load modules (FCROPN, FCRGET, FCRPUT, FCRCLS). All parameters are call-by-reference and there is no return value. Input strings are accepted either without null-termination by supplying an additional length parameter or as null-terminated string with the length parameter set to NULL. When a string is returned, the string is null-terminated and (additionally) the corresponding length field is set, allowing both kinds of string access. The external entry matches the module name (FCROPN), so that the load modules can be linked to the application statically or dynamically.
Generally, the record interface can be used to read any kind of dataset (PS, PDS, PDSE, VSAM, FB, VB with and without ASA resp. control character) on the host, or FLAMFILEs and can also (the main purpose of the interface) read formats from Windows or UNIX systems (including USS) in a record oriented way, translated, for example, into the desired character set. Among other things, this allows reading or writing a remote GZIP file with UTF-8 and delimiters on the host, even though the records with length and data are passed resp. returned in EBCDIC. The read is during this total indepentent of the kind and format of the file. In COBOL you must only know the file name for FCROPN(), to read normal host datasets (PS, PDS, VSAM, ...), member in FLAMFILEs, Windows text files or GZIP files coming from a UNIX systems.
The record interface converts texts (read.text()) to the system-specific character set unless another character set (z.B. ccsid='UTF-8') is supplied, so that the data can be compared to string constants, for example. In other words, the record interface provides a platform-neutral interface for accessing various kinds of file formats.
When reading records, one can decide between reading including ASA or machine control characters (RETAIN), ignoring them (DETACH (default)) or dealing with them like a printer would (RPLFFD=26 (replace form feed with a page size of 26 rows)), for example when processing an FBA or VBA file. For relative files, gaps can be retained as records or ignored. Furthermore, character conversion is also available. Trailing whitespace can be removed or converted to control characters and much more. Additionally, if a record is encountered that is longer than the available buffer, this is signalled with a special return code so that the complete record can be re-read with a larger buffer.
Additional you can also read or write FLAM5 elements like records in form of a certain struture with format.element(). In this case you can overload the default converter by a deticated converter for each element. This feature allows you to validate, collapse and or convert XML elements in programming language specific data types (e.g. picture clause in COBOL). If you know, the next data element must contain a decimal number as string, then you can convert this XML string to an integer value (PICTURE S9(8) COMP) for some calculations.
The record interface allows to decide freely how the data is read. However, in contrast to the byte interface, all data is accepted or returned in the form of records. The record interface is a specialization of the byte interface that always uses record formatting (format.record()).
Example
COBOL
The following example written in COBOL reads records from a GZIP file which is (after binary transfer) located in an XMIT.PDS on the host. It uses the character set auto detection and conversion to IBM-1141 encoded records. The original file was a text file from Windows in CP1252 with 0x0D0A as delimiter. However, since auto detection is used, the character set is not important here. The only thing important is that it is a text file with delimiters. It may happen that empty records ("\n\n") are detected. Due to COBOL requiring a minimum record length of 1, this special case must be handled appropriately. In this example, we just insert a space characters:
To use a DD name at FCROPN is only an example in this case, to make the sample program direct useable as utility in a job (EXEC PGM=SCFCRGET). But normally the record interface are used with dataset or file (path) names (read.file='meine.datei.dat') where the dynamic allocation is done by FLAM. At this you can use the autodetection of the read procedure (read.auto()). Based on this you can read each kind of file in clear records in a transparent way, where only the file name must be known.
C
The following example is a simple C program which accepts the file and format strings for the read and write operation and copies the files using the record interface. Copying, however, is not the correct term in this context because any kinds of conversions can be performed by FLAM via the file strings. Insofar, this simple program exposes a major part of the functionality of FLUC, but with any conversions always being performed on records.