VSAM file processing involves seven COBOL statements:
OPEN
Connect the VSAM data set to your COBOL program for processing.
WRITE
Add records to a file or load a file.
START
Establish the current location in the cluster for a READ NEXT
statement.
START does not retrieve a record; it only sets the current record
pointer, described under "File Position Indicator" in topic 4.3.5.2.
READ and READ NEXT
Retrieve records from a file.
REWRITE
Update records.
DELETE
Logically remove records from indexed and relative files only.
CLOSE
Disconnect the VSAM data set from your program.
All of the following determine which input/output statements are valid for
a given VSAM data set:
° Access mode (sequential, random, or dynamic)
° File organization (ESDS, KSDS, or RRDS)
° Mode of OPEN statement (INPUT, OUTPUT, I-O, or EXTEND).
Figure shows the possible combinations with sequential files (ESDS).
The 'X' indicates that the specified statement may be used with the open
mode given at the top of the column.
_____________________________________________________________________
| Figure Valid COBOL Statements with Sequential Files (ESDS) |
|____________ ____________ __________ __________ __________ __________|
| | VS COBOL II| OPEN | OPEN | OPEN | OPEN |
| Access Mode| Statement | INPUT | OUTPUT | I-O | EXTEND |
|____________|____________|__________|__________|__________|__________|
| Sequential | OPEN | X | X | X | X |
|____________|____________|__________|__________|__________|__________|
| | WRITE | | X | | X |
|____________|____________|__________|__________|__________|__________|
| | START | | | | |
|____________|____________|__________|__________|__________|__________|
| | READ | X | | X | |
|____________|____________|__________|__________|__________|__________|
| | REWRITE | | | X | |
|____________|____________|__________|__________|__________|__________|
| | DELETE | | | | |
|____________|____________|__________|__________|__________|__________|
| | CLOSE | X | X | X | X |
|____________|____________|__________|__________|__________|__________|
Figure shows the possible combinations with indexed (KSDS) and relative
(RRDS) files. The 'X' indicates that the specified statement may be used
with the open mode given at the top of the column.
_____________________________________________________________________
| Figure Valid COBOL Statements with Indexed Files (KSDS) and |
| Relative Files (RRDS) |
|____________ ____________ __________ __________ __________ __________|
| | VS COBOL II| OPEN | OPEN | OPEN | OPEN |
| Access Mode| Statement | INPUT | OUTPUT | I-O | EXTEND |
|____________|____________|__________|__________|__________|__________|
| Sequential | OPEN | X | X | X | X |
|____________|____________|__________|__________|__________|__________|
| | WRITE | | X | | X |
|____________|____________|__________|__________|__________|__________|
| | START | X | | X | |
|____________|____________|__________|__________|__________|__________|
| | READ | X | | X | |
|____________|____________|__________|__________|__________|__________|
| | REWRITE | | | X | |
|____________|____________|__________|__________|__________|__________|
| | DELETE | | | X | |
|____________|____________|__________|__________|__________|__________|
| | CLOSE | X | X | X | X |
|____________|____________|__________|__________|__________|__________|
| | | | | | |
|____________|____________|__________|__________|__________|__________|
| Random | OPEN | X | X | X | |
|____________|____________|__________|__________|__________|__________|
| | WRITE | | X | X | |
|____________|____________|__________|__________|__________|__________|
| | START | | | | |
|____________|____________|__________|__________|__________|__________|
| | READ | X | | X | |
|____________|____________|__________|__________|__________|__________|
| | REWRITE | | | X | |
|____________|____________|__________|__________|__________|__________|
| | DELETE | | | X | |
|____________|____________|__________|__________|__________|__________|
| | CLOSE | X | X | X | |
|____________|____________|__________|__________|__________|__________|
| | | | | | |
|____________|____________|__________|__________|__________|__________|
| Dynamic | OPEN | X | X | X | |
|____________|____________|__________|__________|__________|__________|
| | WRITE | | X | X | |
|____________|____________|__________|__________|__________|__________|
| | START | X | | X | |
|____________|____________|__________|__________|__________|__________|
| | READ | X | | X | |
|____________|____________|__________|__________|__________|__________|
| | REWRITE | | | X | |
|____________|____________|__________|__________|__________|__________|
| | DELETE | | | X | |
|____________|____________|__________|__________|__________|__________|
| | CLOSE | X | X | X | |
|____________|____________|__________|__________|__________|__________|
No comments:
Post a Comment