<s>
In	O
IBM	B-Device
mainframe	I-Device
operating	B-General_Concept
systems	I-General_Concept
,	O
Basic	B-Application
sequential	I-Application
access	I-Application
method	I-Application
(	O
BSAM	O
)	O
is	O
an	O
access	B-Application
method	I-Application
to	O
read	O
and	O
write	O
datasets	O
sequentially	O
.	O
</s>
<s>
BSAM	O
is	O
available	O
on	O
OS/360	B-Application
,	O
OS/VS2	B-Application
,	O
MVS	B-Application
,	O
z/OS	B-Application
,	O
and	O
related	O
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
BSAM	O
is	O
used	O
for	O
devices	O
that	O
are	O
naturally	O
sequential	O
,	O
such	O
as	O
punched	B-Architecture
card	I-Architecture
readers	O
,	O
punches	O
,	O
line	O
printers	O
,	O
and	O
magnetic	B-Architecture
tape	I-Architecture
.	O
</s>
<s>
It	O
is	O
also	O
used	O
for	O
data	O
on	O
devices	O
that	O
could	O
also	O
be	O
addressed	O
directly	O
,	O
such	O
as	O
magnetic	B-Device
disks	I-Device
.	O
</s>
<s>
BSAM	O
offers	O
device	O
independence	O
:	O
to	O
the	O
extent	O
possible	O
,	O
the	O
same	O
API	B-Application
calls	O
are	O
used	O
for	O
different	O
devices	O
.	O
</s>
<s>
BSAM	O
allows	O
programs	O
to	O
read	O
and	O
write	O
physical	O
blocks	B-General_Concept
of	O
data	O
,	O
as	O
opposed	O
to	O
the	O
more	O
powerful	O
but	O
less	O
flexible	O
Queued	B-Application
Sequential	I-Application
Access	I-Application
Method	I-Application
(	O
QSAM	B-Application
)	O
which	O
allows	O
programs	O
to	O
access	O
logical	O
records	O
within	O
physical	O
blocks	B-General_Concept
of	O
data	O
.	O
</s>
<s>
The	O
BSAM	O
user	O
must	O
be	O
aware	O
of	O
the	O
possibility	O
of	O
encountering	O
short	O
(	O
truncated	O
)	O
blocks	B-General_Concept
(	O
blocks	B-General_Concept
within	O
a	O
dataset	B-Application
which	O
are	O
shorter	O
than	O
the	O
BLKSIZE	O
of	O
the	O
dataset	B-Application
)	O
,	O
particularly	O
at	O
the	O
end	O
of	O
a	O
dataset	B-Application
,	O
but	O
also	O
in	O
many	O
cases	O
within	O
a	O
dataset	B-Application
.	O
</s>
<s>
QSAM	B-Application
has	O
none	O
of	O
these	O
limitations	O
.	O
</s>
<s>
The	O
programmer	O
specifies	O
DSORG	B-Application
=	O
PS	O
in	O
his	O
Data	B-Application
Control	I-Application
Block	I-Application
(	O
DCB	O
)	O
to	O
indicate	O
use	O
of	O
BSAM	O
.	O
</s>
<s>
As	O
a	O
basic	O
access	B-Application
method	I-Application
BSAM	O
reads	O
and	O
writes	O
member	O
data	O
in	O
blocks	B-General_Concept
and	O
the	O
I/O	O
operation	O
proceeds	O
asynchronously	B-Architecture
and	O
must	O
be	O
tested	O
for	O
completion	O
using	O
the	O
CHECK	O
macro	O
.	O
</s>
<s>
If	O
the	O
dataset	B-Application
is	O
unblocked	O
,	O
that	O
is	O
,	O
the	O
logical	O
record	O
length	O
(	O
LRECL	O
)	O
is	O
equal	O
to	O
the	O
physical	O
block	B-General_Concept
size	I-General_Concept
(	O
BLKSIZE	O
)	O
,	O
BSAM	O
may	O
be	O
utilized	O
to	O
simulate	O
a	O
directly	O
accessed	O
dataset	B-Application
using	O
NOTE	O
and	O
POINT	O
on	O
any	O
supported	O
direct	O
access	O
device	O
type	O
(	O
DEVD	O
=D	O
A	O
)	O
,	O
and	O
some	O
primitive	O
applications	O
were	O
designed	O
in	O
this	O
way	O
.	O
</s>
<s>
The	O
BSAM	O
application	B-Application
program	I-Application
interface	I-Application
can	O
be	O
compared	O
with	O
the	O
interface	O
offered	O
by	O
open	O
,	O
read	O
,	O
write	O
and	O
close	O
calls	O
(	O
using	O
file	O
handles	O
)	O
in	O
other	O
operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
Unix	B-Application
and	O
Windows	B-Application
.	O
</s>
