FSWRITE Macros
3. fields in the file status table are in packed decimal format with the exceptions noted above.
If an error occurs, register 15 contains one of the error
codes: 2Q 23
36 !1ggni!!g Invalid character in fileid Invalid filemode
Fi Ie not found
Disk not accessed FSWRITE Use the FSWRITE macro instruction to write a record from an IIO buffer
to a CMS lisk file. The format of the FSWRITE macro instruction is:
r i , rlabell , FSWRITE {
fileid(,FSCB=fscb] } [,ERROR=erraddr](,optionS],'
FSCB=fscb
L : label filei:l is an optional statement label.
specifies the CMS file identifier. It may be:
'fn ft fm' the fileid enclosed in single quotation marks and
separated by blanks. If fm is omitted, A1 is
assumed.
(reg) a register other than 0 or 1 containing the
address of the fileid (18 characters). When register format is used, the fileid must be
exactly 18 characters in length; 8 for the
filename, 8 for the filetype, and 2 for the
filemode. Shorter name must be filled with
blanks. FSCB=fs=b specifies the address of an FSCB. It may be: llbel (req) ERROR=erraddr the label on an FSCB macro instruction.
a register containing the address of an FSCB. specifies the address of an error routine to be given control
if an error is found. If ERROR= is not coled and an error occars, control returns to the next sequential instruction in
the calling proqram, as it does if no error occurs. Yoa can specifv any of the followinq FSCB macro options on the FSWRITE macro instruction: BUFFER=buffer REC"lO=number BSIZE=size NOREC=numrec
RECFM=format
312 CMS Command and Macro Reference
FSWRITE Macro
These options may be specified either as the actual value (for
example, NOREC=l) or as a register that contains the value (for
example, NOREC=(3) where register 3 contains the value 1). When you use any of these options, the associated field in FSCB for the file is filled in or modified. 1. If an FSCB macro instruction has not been coded for a file (and the FSCB= operand is not coded on the FSWRITE macro instcuction), you
must specify the BUFFER= and BSIZE= options to indicate the
location of the read/write buffer and the length of the record to
be written. For the filemode, you must specify both a letter and a
number. If the file is a variable-length file, you must also
specify REC'FM=V. 2. On return from the FSWRITE macro, register 1 contains the address
of the FSCB for the file. If no FSCB exists, one is created
following the FSWRITE macro instruction.
3. If you specify both fileid and FSCB=, the fileid is used to fill in
the FSCB. 4. If the HECNO option is specified (either on the FSWRITE macro
instruction or in the FSCB), that specified record is written. Otherwise, the next sequential record is written. For new files,
writing begins with record 1 ; for existing files, writing begins
with the first record following the end of the file.
5. To write records sequentially beginning a particular record
number, use the RECNO option to specify the first record to be
written. On the next FSWRITE macro instruction, use RECNJ=O so that
writing continues sequentially, following the first record written.
6. To write blocked records (valid for fixed-length files only), use
the BSIZE and NOREC options to specify the blocksize and number of
records per block, respectively. For example r to write 80-byte records into 800-byte blocks, you should specify BSIZE=800 and NOREC=10. The buffer you use must be at least 800 bytes long.
7. When using the FSWRITE macro to update an existing file of variable
records, ensure that the replacement record length is equal to the
original record length. Any attempt to replace a record in the
file with one that is shorter or longer than the original record,
will cause the file to be truncated at the specified record number.
No error return code results.
If an error occurs, register 15 contains one of the following error
codes: Invalid buffer address
First character of filemode is invalid Second character of filemode is invalid
Item number too large (more than 65,533)
Attempt to skip over unwritten variable-length item
Section 6. CMS Macro Instructions 313
Previous Page Next Page