Vivek8086
Vivek8086

Reputation: 47

Pointer position at the time of VSAM START command

I am a bit confused. I know when you START a VSAM file, a pointer is set to a specific record, which will be read by subsequent READ command.

Let's assume that VSAM has records:

100
200
300
400
500

When you write:

START filename
 KEY IS GREATER THAN 400

It will place pointer at 500. But if you say

START filename
 KEY IS GREATER THAN 600

where will the pointer be placed ?

Will it be on 500 or will it be an error.

Also, my understanding is that START will never give an end of file (RETURN CODE 10).

Upvotes: 0

Views: 903

Answers (1)

Rick Smith
Rick Smith

Reputation: 4407

The pointer will not be positioned to any record.

An INVALID KEY condition will be raised with FILE STATUS "23", indicating no record found.

From the 2002 COBOL standard:

"14.8.37.3 General rules

"7) Following the unsuccessful execution of a START statement, the file position indicator is set to indicate that no valid record position has been established. For indexed files, the key of reference is undefined."

Upvotes: 5

Related Questions