Professional Documents
Culture Documents
Original - 1400483237 - COBOL L8T2 v1.0
Original - 1400483237 - COBOL L8T2 v1.0
1
File Processing
Indexed Files
2
Sequential Retrieval in RRDS
For Sequential retrieval in RRDS, the ACCESS should be sequential.
SELECT <vsamfile>
ASSIGN TO <ddname>
ORGANIZATION IS RELATIVE
ACCESS IS SEQUENTIAL
RELATIVE KEY IS RR-NUMBER
3
Direct Retrieval in RRDS
For direct retrieval in RRDS, the ACCESS should be Random.
SELECT <vsamfile>
ASSIGN TO <ddname>
ORGANIZATION IS RELATIVE
ACCESS IS RANDOM
RELATIVE KEY IS RR-NUMBER.
4
Sequential Retrieval in KSDS
For sequential retrieval in KSDS, the ACCESS should be Sequential.
SELECT <vsamfile>
ASSIGN TO <ddname>
ORGANIZATION IS INDEXED
ACCESS IS SEQUENTIAL
RECORD-KEY IS EMP-NUM
FILE-STATUS IS STATUS-KEY.
5
Direct Retrieval in KSDS
For direct retrieval in KSDS, the ACCESS should be Random.
SELECT <vsamfile>
ASSIGN TO <ddname>
ORGANIZATION IS INDEXED
ACCESS IS RANDOM
RECORD-KEY IS EMP-NUM
FILE-STATUS IS STATUS-KEY.
6
READ STATEMENT - INDEXED
For random access of data, the READ statement :
[INTO data-name]
[END-READ].
8
Illustration to READ using a Key
9
WRITE STATEMENT - INDEXED
[END-WRITE]
Example :
WRITE REL-OUTPUT
INVALID KEY
GO TO ERROR-PARA.
10
REWRITE STATEMENT - INDEXED
Used to replace a logical record for an output file whose key matches the
current content of the record key.
The file must be opened in I-O mode.
Syntax :
[END-REWRITE].
11
START STATEMENT - INDEXED
Enables the programmer to position the relative file at some specified point
by setting the current record pointer for later sequential processing.
Syntax :
START FILE-NAME
[END-START].
12
DELETE STATEMENT - INDEXED
Used to delete a record whose key matches the current contents of the record
key.
Syntax :
[END-DELETE].
13
Thank You
14