OPEN (VSAM)
Syntax:
OPEN('VSAM',ddname[,options][,password])
Arguments:
-
'VSAM'
-
indicates that the VSAM 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.
Note: The names 'VSAM', 'QSAM', and 'BPAM' are reserved.
Do not use these strings for ddnames.
-
options
-
a character string describing the processing options for the data
set. You may specify the options in any order. If multiple
options are coded, they must be enclosed in parentheses and
separated by commas. The options are organized into several
groups. The options in some groups are additive. That is, you may
specify one or more of the options in that group. Other groups
have alternative options. From each group you may select only one
option. The groups, their types, options, and descriptions are
given in the section,
"OPEN (ACB) Options".
-
password
-
a character string that contains the highest-level password
required for the options specified in the options argument. If no
password is supplied, but one is required, VSAM will prompt the
console operator for the password.
Note: Passwords are not supported for SMS-managed data
sets. You must have the appropriate security package (RACF, ACF2,
etc.) authorization to open SMS-managed data sets.
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 VSAM interface is in no way
connected with the REXX EXECIO command. You may use EXECIO and
the REXXTOOLS
QSAM
and
BPAM
interfaces to access non-VSAM files at the same time you are
accessing VSAM files.
Returned Information:
The OPEN function returns the VSAM 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. If the function
call was successful, several other special REXX variables are
created. You should treat these variables as "read only" and
make no attempt to modify any of them. The variables are:
-
RC
-
Contains the VSAM OPEN return code. Zero means the operation was
completed successfully.
-
REASON
-
Contains the VSAM OPEN reason code.
-
$SWXTYPE
-
Indicates the type of data set that has been opened: 'KSDS', for
key- sequenced data sets; 'ESDS', for entry-sequenced data sets;
'RRDS' for relative record data sets; 'VRDS' for variable-length
relative record data sets; and 'LDS', for linear data sets.
Note: Linear data sets can be accessed by control interval
only.
-
$SWXLRCL
-
Specifies the maximum record length of records in the opened data
set.
-
$SWXCNVL
-
Specifies the length of a control interval for the data set.
-
$SWXKEYO
-
Specifies the offset of the key field in the records of the data
set (this variable has meaning for KSDSs only).
Note: The value of $SWXKEYO is zero- based. Thus a key
that begins in the first byte of a record has an offset of 0; one
that begins in the second byte has an offset of 1; and so on.
-
$SWXKEYL
-
Specifies the length of the keys in a key-sequenced data set's
records.
-
$SWXRECS
-
Specifies the number of records currently in the data set.
Note: The value of the $SWXRECS variable is derived from
the "statistics" portion of the entry for the data set. An
alternative display of this information may be obtained from the
"LISTC ENT(data set name) ALL" command. Be aware that the number
of records can be inaccurate if the file is open for update by
another program, or if the last program to update the data set
failed to properly close it. Use the IDCAMS EXPORT and
IMPORT commands to reset the statistics.
-
$SWXHRBA
-
Specifies the relative byte address of the end of the data set
(applies only to the data component for KSDSs).
-
$SWXERBA
-
Specifies the high-used RBA. (applies only to the data component
for KSDSs).
Examples:
-
Open a KSDS for sequential read access:
if open('vsam','indd') <> 0 then say 'Open failed.'
Note that no options are specified because '(KEY,SEQ,IN)' are
defaults.
-
Open a KSDS for direct reading and writing:
call open 'vsam', 'indd', '(key,dir,in,out)'
Note that while '(KEY,IN)' are defaults, we have coded them
explicitly in this case (if nothing else, explicitly coded
options serve as good documentation of what you are trying to
accomplish).
-
Open an ESDS for direct read access:
call open 'vsam', 'indd', '(dir,adr)'
This example shows that you can specify the options in any order.
© Copyright 1998 by Open Software Technologies, Inc.