OPEN (QSAM)
Syntax:
OPEN('QSAM',ddname[,option])
Arguments:
-
'QSAM'
-
indicates that the QSAM access method is to be used to
open the file. This argument must be coded as shown.
-
ddname
-
is the 1 to 8 character name that identifies the data set
you want to process. This name needs to have been
previously associated with the data set, either via the
ALLOCATE command or JCL DD statement. If you try to open a
ddname that is already open, the request is ignored and no
error indication is given.
Note: The names 'VSAM', 'QSAM', and 'BPAM' are reserved.
Do not use these strings for ddnames.
-
option
-
one of the following values may be used:
-
'INPUT'
-
indicates that records will be read, only. This
is the default.
-
'OUTPUT'
-
indicates that records will be written, only.
-
'UPDATE'
-
indicates that records will be read, and that
some or all records may be re-written.
Module Name:
SWXOPEN
Service Description:
OPEN is used to "connect" your program to a data set. You must
open a data set before you can get (using the
GET
function) records from the data set, or put (using the
PUT
function) records into the data set. All data sets should be
closed (using the
CLOSE
function) when you are finished using them.
Note: The Shadow REXXTOOLS QSAM interface is in no way
connected with the REXX EXECIO command.
Returned Information:
The OPEN function returns the QSAM OPEN macro return code. If you
CALL the OPEN function, the returned value is contained in the
RESULT special variable.
After completion of an OPEN function call, the RC and REASON
variables will contain return code information. Several other
variables are also produced. You should treat these variables as
"read only" and make no attempt to modify any of them. The
variables are:
-
RC
-
Contains the QSAM OPEN return code. An RC of zero means the
operation was completed successfully.
-
REASON
-
Contains the QSAM OPEN reason code.
-
$SWXRECFM
-
Indicates the record format of the
data set.
-
$SWXLRECL
-
Specifies the maximum record length
of records in the opened data set.
-
$SWXBLKSI
-
Specifies the maximum length of a
block for the data set.
-
$SWXBUFNO
-
Specifies the number of BLKSIZE-sized
buffers that will be used in
performing input/output operations.
Examples:
-
Allocate and open a sequential file for read access:
"alloc fi(indd) da(user.data) shr reu"
if open('qsam','indd') <> 0 then say 'Open failed.'
Note that no option is specified because 'INPUT' is the default.
-
Allocate and open a PDS member for update access:
"alloc fi(iodd) da(mypds.data(stuff)) shr reu"
call open 'qsam', 'iodd', 'update'
if rc <> 0 then say 'Open failed. REASON='reason
© Copyright 1998 by Open Software Technologies, Inc.