FWRITE numfile,string[,RECLEN=rec-length][,RECNUM=rrn]
This statement write a record into the file numfile; string will contain this record and its length must be equal (or less) to the record length
numfile is a numeric constant (from 1 to 20) used in FOPEN statement to handle the file.
rrn is the Relative Record Number (an integer variable) and can be used to write in a RRDS VSAM file in a free slot, using direct access.
rec-length is an optional parameter that simply overrides the length of string.Let's summarize now how to use this instruction:
For a VSAM file (MVS/TSO/DOS/CICS):
- for a KSDS, string contains the record to write with a key not actually used in the file
- for a ESDS, the record is written at the end of the file
- for a RRDS, the record is written at the end of the file if you don't use RECNUM= parameter; otherwise is written in the (free) position number showed by this integer variable
For a sequential (SAM) file (MVS/TSO/DOS):
- for a sequential access (the only allowed access method) the record is written at the end of file (see DISP parameter in the JCL)
For a CMS file (CMS):
- for a sequential access don't use any RECNUM parameter and the write is from the last pointed record: first record if it is a new file or the file is opened with REPLACE, is from the middle of the file if statement FSTARTBR is previously used to modify last pointed record
- for a direct access write specify RECNUM= with an integer variable containing the record number
- if file is opened with TYPE=PRT or PUN, record is printed (and must be 133 long, with control character in column 1) or punched (and record must be 80 characters long)
$RCFILE Hilmas variable contains the Return code; $RCVSAM is filled only managing VSAM files; no return coded is managed for SAM files.
Parameter Name Mode Type coding Remark 1 numfile Input numeric constant from 1 to 20 2 string Output String C or X Record to write RECNUM= Input Integer F for a RRDS or CMS direct access RECLEN= Input Integer F or H or const.