FSOPEN, FSREAD Macros 2. If you code both fileid and FSCB=, the fileid is used to fill in
the FSCB. 3. YO] can use the FSOPEN macro instruction to verify the existence of
a file to be opened for reading or writing and to create an FSCB fOL it.
If an error occurs, register 15 contains one of the following error
codes: 20 24
28
36 !1§!ling Invalid file identifier
Invalid filemode
File does not exist
Disk not accessed
FSREAD Use the FSREAD macro instruction to read a record from a disk file into
an 1/0 buffer. The format of the FSREAD macro instruction is: r I [label] I L- label
fileid
------------------------.-------------------------------,
FSREAD
{
fileid[,FSCB=fscb] }C,ERROR=erraddr] [,options] II FSCB=fscb
____ .--1 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 flleid must be
exactly 18 characters in length; 8 for the
filename, 8 for the filetype, and 2 for the
filemode. Shorter names must be filled with
blanks.
FSCB=fscb specifies the address of an FSCB. It may be:
label (reg) ERROR=eJ:"raddr the label of an FSCB macro instruction.
a register containinq the address of an FSCB. specifies the address of an error routine to be given control
if error is found. If ERROR= is not coded and an error
occurs, control returns to the next sequential instruction in
the callinq program, as it does if no error occurs.
Section 6. CMS Macro Instructions 309
FS READ Macro 1 YJU can soecify any of the following FSCB macro options on the FSREAD macro instruction: BUFFER=buffer NOREC=numrec
BSIZE=size
RECNO=number These options may be specified either as the actual value (for eKample, NOREC=1) or as a register that contains the value (for eKample, NOREC=(3) where register 3 contains the value 1). When you use any of these options, the associated field in the F3CB is modified.
If an FSCB macro instruction has not been coded for a file (and FSCB= operand is not coded), you must specify the BUFFER= BSIZE= options to indicate the address of the buffer and
length. When reading variable-length records, a record that
longer than the buffer length is truncated.
the
and
its
is
2. In from the FSREAD macro, register 1 points to the FSCB for the file. If no FSCB exists, one is created following the FSREAD ma=ro instruction.
3. If yon specify both fileid and FSCB=, the fileid is used to fill in
the FSCB. 4. Fegister 0 contains, after the read operation
number of bytes actually read. This information
in the FSCBNORD field of the FSCB. is complete, the
is also contained s. To read records sequentially beginning with a particular record ncrmber, use the RECNO option to specify the first record to be
read. On the next FSREAD macro instruction, use RE:NO=O so that reaaing continues sequentially following the first record read.
If an error occurs, register 15 contains one of the following error
codes: 1
2
3
5
7
B q 11
12
13 15 File not found
Invalid buffer address ?ermanent IIO error
Number of records to be read is less than or equal to zero,
or greater than 32,768
Invalid record format (only checked when the file is first
opened for reading)
Incorrect length
File open for output
Nllmber of records greater than 1 for variable-length file
End of file, or record number greater than number of in data set (maximum number of records is 65,533)
Variable-length file has invalid displacement in active file
table
Invalid character in filename
Invalid character in filetype 310 IBM VM/370 CMS Command and Macro Reference
Previous Page Next Page