IBM 5110 User Manual page 128

Apl
Table of Contents

Advertisement

After the operation is specified, the I/O processor assigns a return
code to the shared variable. The I/O processor then assigns a new
record from the data file to the shared variable each time the shared
variable is referenced. For example: First, to create a sequential
access file with 5 records.
VSEQUENT I AL [[1:1 'V
'V
SE(~UENT
I AL.
[1J
SV~'OUT
1100~
ID~(SEQ)
TYPE=A'
r:::.~]
I~"l
[3J
L.OOP:~(v/O~X~SV)/ERROR
[~J
SV~'RECORD
'1,1
[5J
4(5~I~I+l)/L.OOP
[6]
SVf"
0
[7J
~(A/O=X~SV)/O
[8J
ERROR: 'CREATING THE DATA FILE FAILED. THE RETURN CODE IS:
I
l'
X
SE(~LJENT
I
AI . . .
Now, to read the 5 records from the data file.
() 0
SV~-'
IN
1[1::::
(BE(~)
S V - · - - - - - - - - - - y o u should check the return code after the
operation is specified.
c.'V
REef)
I~D
\o):L
=~-------~--.
After the return code is checked, each time
SV -
/
the shared variable is referenced, the I/O
REeO RD 2
processor assigns the next record from the
SV
data file to the shared variable.
RECOI~D
~5
X~"BV"4--------lf
you want to save a record for later use, you
X
must assign the shared variable to another variable.
RECOI~n
1.1·
BV
RECOI~D
~:j
~
After the last record is read from the file, an empty
S V
vector (sO) is assigned to the shared variable. This
_
empty vector terminates the operation. (In a
() 0
S V
user-defined function, you can check for the
empty vector. For example:
~
(0
=
pX
<E-
SV)/DONE.
The statement branches to DONE if the last record
read was an empty vector.)
Input/Output Control
123

Advertisement

Table of Contents
loading

Table of Contents