Rfile - Read or write record files

Synopsis

Rfile -r | -w | -h [-abKlqQs] [-c CL-command] [-C CL-command] file ...

Description

The Rfile utility reads i5/OS record files (database or device files) and writes the data to standard output, or reads standard input and writes the data to record files.

Note:
This utility is unique to i5/OS.

Options

-a
Append the contents of standard input to the record file. This option only applies when -w is specified. If -w is specified without -a, any physical file member is cleared before writing the contents of the stream.
-b
Process binary data. This option prevents normal processing for newline characters in the input or output stream. When -b is omitted, newline characters are removed from standard input lines written to a record file, and newline characters are inserted at the end of records written to standard output.
-c CL-command
Run a CL command in the utility process before processing any record file. This option can be used to run a CL override command that specifies device-dependent parameters for a record file. If more than one -c option is specified, the CL commands are processed in sequence before processing any record file.
-C CL-command
Run a CL command in the utility process after processing all record files. If more than one -C option is specified, the CL commands are processed in sequence after processing all record files.
-h
Write a brief description of command syntax to standard error.
-K
Keep the job log at job termination. The system normally deletes the job log after running a QShell utility. This option forces the system to produce a job log listing (which may assist with problem determination) when the job that runs Rfile ends.
-l
Do not truncate long text lines. This option only applies to text data. When -l is specified, any standard input line longer than one output record is folded onto as many records as necessary, and no trailing blanks are removed from records written to standard output.
-q
Suppress warning messages. This option suppresses messages normally written to standard error when long text lines are truncated or folded in the output file.
-Q
Use i5/OS qualified name syntax for file names. When this option is specified, the file names specified as command operands are i5/OS qualified names (instead of Integrated File System path names).
-r
Read the specified record files and write their contents to standard output. Either -r or -w, but not both, must be specified.
-s
Process source sequence number and date fields as text. This option only applies to text processing of FILETYPE(*SRC) record files. When -s is specified, the entire contents of every record is processed as a text line. If -s is omitted, the first 12 bytes is stripped from every source record read, and the first 12 bytes of every source record written is filled with a sequence number and zeros for the date field.
-w
Read standard input and write its contents to the specified record file. The output file must already exist, or an error is reported (and no file is created). Either -r or -w, but not both, must be specified.

Operands

At least one i5/OS record file name must be specified. If more than one file is specified, they are processed in sequence as end of file is reached on each input source. When option -Q is omitted, files are identified by path names in the Integrated File System. If option -Q is specified, file names are specified in any of these forms:


	file
	library/file
	'file(member)'
	'library/file(member)'

If the library name is omitted or *LIBL is specified for the library name, the file is located using the job library list. If the member name is omitted or *FIRST is specified as the member name, the first member of a database file is opened. Specifying *LAST for the member name opens the last member of a database file. Member name *ALL can be used with option -r to read all members of a database file (from first to last). Member names are ignored for device files (when specified in i5/OS qualified name form).

Examples

  1. Read the contents of source database member QSYSINC/H(SQLCLI), and write it to standard output. Trailing blanks are removed from each line, as are the first 12 characters of each line (containing sequence number and date information):
    
    Rfile -rQ 'qsysinc/h(sqlcli)'
    
  2. Write the contents of stream file mydoc.ps to spooled printer device file QPRINT as unconverted ASCII data, and then use the CL LPR command to send the spool file to another system:
    
    before='ovrprtf qprint devtype(*userascii) spool(*yes)'
    after="lpr file(qprint) system(usrchprt01) prtq('rchdps') transform(*no)"
    cat -c mydoc.ps | Rfile -wbQ -c "$before" -C "$after" qprint
    
  3. Copy the contents of save file INSAVF in library QGPL to another save file named OUTSAVF located using the job library list. Note that the data is read and written in binary mode to avoid ASCII/EBCDIC conversion and newline processing:
    
    Rfile -rb /qsys.lib/qgpl.lib/insavf.file | Rfile -wbQ outsavf