The below example shows how we can write code in COBOL program to read VSAM file. I am giving here the best method how we can give.
Related Posts
Simple Read just like sequential files:
OPEN INPUT sample-file. READ sample-file INTO identifier. AT END statement.
Write:
WRITE record-name FROM identifier INVALID KEY statement.
Establishing a Key
Move 'xxxxxx' TO key-value START sample-file KEY IS EQUAL TO key-value
Now position is established with start command. To read a record from a file into your working storage area, we need to give either READ or READ NEXT.
Rules for using READ or READ NEXT:
READ - we need to give if we have given access mode is sequential. RED NEXT - we need to give , if we have given access mode is random.
Unless you give READ or READ NEXT, the record from the file will not be fetched.
Recent Posts
One thought
Comments are closed.