This function performs I/O operations on VSAM data sets.
Form 1:
acb = VSAM(OBTAIN,[scope],cbtype)
Form 2:
VSAM(option1,acb)
Form 3:
status = VSAM(STATUS,acb)
Form 4:
VSAM(MODCB,acb,modopt1)
Form 5:
VSAM(MODCB,rpl,modopt2)
Form 6:
dsname = VSAM(DSNAME,acb)
Form 7:
VSAM(POINT,rpl,key)
Form 8:
record = VSAM(act1,rpl,[key])
Form 9:
VSAM(act2,rpl,record)
Form 10:
VSAM(act3,rpl)
Parameters
ID for a VSAM ACB and an associated internal workspace.
Obtains a new RPL or ACB.
Specify one of these values:
Indicates that the file is local to the IMOD. The RPL or ACB is automatically released at the end of the IMOD.
Indicates that you can share this file across IMODs. The RPL or ACB must be released explicitly.
Default: LOCAL
Specify one of these values:
Obtains an ACB control block.
Obtains an RPL control block.
Specify one of these values:
Opens a file for processing.
Completes processing.
Temporarily closes the file. This option writes all information to disk and updates all pointers. However, the file remains open and processing can continue.
Returns handle value to the system to free storage used.
The current status of data set (OPEN or CLOSED) as returned by the STATUS operation.
Returns the status of the ACB.
Modifies the VSAM RPL or ACB.
Specify one of these values:
Modifies the DDNAME value of the ABC. Only effective if the data set is closed.
Modifies the MACRF values of the ABC. Choose one or more of the following values, which are separated by commas: SEQ, OUT, RST, NRS, DIR, KEY, IN. Descriptions of these options can be found in the IBM VSAM reference guides.
rpl
ID for a VSAM RPL and an associated internal workspace.
modopt2
Specify one of these values:
Modifies the ACB value of the RPL. Before you can use an RPL for operations on a data set, it must be linked to an open ACB.
Modifies the KEY field of the RPL. You can set this field directly in the RPL without using the POINT, GET, or the DELETE operations.
Modifies the OPTCD values of the RPL. Choose one or more of these values, which commas separate: FWD, BWD, SEQ, DIR, KEY, FKS, GEN, UPD, NUP, NSP, KEQ, KGE.
Data set name of an open data set. The cluster name.
Returns the cluster name of an open data set.
Useful in sequential mode, a POINT operation positions the file to the record that matches key. Subsequent GETs then retrieve records, beginning with the desired one.
Key of the desired record. For KSDS processing, the full key or partial key, and the match must be exact or not less than the key value, depending on the processing mode. For RRDS and ESDS processing, key is the numeric relative record number or RBA, respectively.
Record text. Includes the key for keyed records.
Specify one of these values:
Obtains a record. For sequential mode processing, returns next logical record. For direct mode processing, returns record whose key is in the RPL. Direct mode processing permits specification of the key with GET.
Deletes the specified record (by key). This is an extension of VSAM functions. Normally, first read the record to be erased and then erase it. DELETE eliminates the need to perform the GET.
Specify one of these values:
Writes a record. Depending upon the update status, a new record is inserted or the current record is replaced. For RRDS and ESDS processing, the key argument is required for a non-update write. For KSDS processing, the key is embedded in the record.
Replaces the specified record (by key). This is an extension of VSAM functions. Normally, first read the record to be updated and then replace it. UPDATE eliminates the need to perform the GET. If the record to be updated does not exist, it is added.
Specify one of these values:
In UPDATE mode, causes the last read record to be deleted from the file.
Terminates any operation in progress on an RPL. For example, if you have read a record for update and then you change your mind, issue an ENDREQ to free the RPL. Otherwise, update or erase the record to complete the operation.
ARG n MISSING OR INVALID
DELETE NOT MATCHED
ADD AND UPDATE FOR RECORD BOTH FAILED
NOT RPL
NO RPL
NOT ACB
NO ACB
DATASET IS OPEN
DATASET NOT OPEN
PHASE: phase RETURN: ret REASON rea
This is returned for an RPL-based error. phase indicates the failing operations (for example, GET), ret is the value that is returned in the RPLRET field, and rea is the value that is returned in the RPL FDBK2 field. These values are explained in detail in the IBM VSAM reference guides.
PHASE: phase R15: ret REASON: rea
This is returned for a non-RPL-based error. phase indicates the failing operation (for example, CLOSE), ret is the value that is returned (by VSAM) in register 15, and rea is the value that is returned (by VSAM) in register 0. These values are explained in detail in the IBM VSAM reference guides.
OPEN ERROR. CODE=code
code is the VSAM error code, as explained in the IBM VSAM reference guides.
Example
/* DDname JUNK was already allocated */ acb = vsam('OBTAIN','ACB') /* Obtain an ACB */ rpl = vsam('OBTAIN','RPL') /* Obtain an RPL */ x = vsam('MODCB',acb,'DDNAME=JUNK','MACRF=SEQ,DIR,OUT') /* Modify the ACB for the desired file*/ x = vsam('MODCB',rpl,'ACB='||acb) /* Point the RPL back to the ACB */ x = vsam('OPEN',acb) /* Open the file */ x = vsam('MODCB',rpl,'OPTCD=DIR,FKS,KEQ,UPD') /* Modify the RPL to perform direct I/O,full key,key equal,and fetch for update */ record = vsam('GET',rpl,key) /* Fetch the record that matches the value found in "key" */ record = key||newdata /* construct new record, retaining the key */ x = vsam('PUT',rpl,record) /* Write the updated record */ x = vsam('CLOSE',acb) /* Close the file */ /* The next two calls are automatic at IMOD end */ vsam('release',acb) == '' /* Clean up */ vsam('release',rpl) == '' /* Clean up */
Copyright © 2014 CA Technologies.
All rights reserved.
|
|