You need to get hold of a copy of the Enterprise COBOL Language Reference for the version of Enterprise COBOL you are using. This will most likely be V3.4, V4.1 or V4.2, possibly V5.1 (released in June last year).
For this particular question, any version will do, but going forward it is good to know where to find the one specific to the version of COBOL you are using. Also get the Programming Guide as well.
An internet search for IBM Enterprise COBOL for z/OS library
should get you to a page where you can easily locate the correct one.
Locate the ASSIGN
clause in the Language Reference.
Format: assignment-name for QSAM files
label-S-name
Format: > assignment-name for VSAM sequential file
label-AS-name
Format: > assignment-name for line-sequential, VSAM indexed, or VSAM relative
file
label-name
label- Documents (for the programmer) the device and device class to
which a file is assigned. It must end in a hyphen; the specified value
is not otherwise checked. It has no effect on the execution of the
program. If specified, it must end with a hyphen.
S- For QSAM files, the S- (organization) field can be omitted. AS- For
VSAM sequential files, the AS- (organization) field must be specified.
**For VSAM indexed and relative files, the organization field must be omitted.**
name
A required field that specifies the external name for this file.
Thus, a VSAM KSDS or RRDS requires that the ASSIGN contains very limited information, a label, which is syntax-checked but otherwise not used.
In the past, information in the ASSIGN would have had many more meanings. A different COBOL on a different Operating System may have different requirements. For Enterprise COBOL for z/OS, the ASSIGN is very simple.
In the Programming Guide you will find a Chapter on processing VSAM files. It will assist you in this task.
From that Chapter, an example SELECT statement for a KSDS:
SELECT R-FILE
ASSIGN TO RELATIVE-FILE
ORGANIZATION IS RELATIVE
ACCESS IS RANDOM
RELATIVE KEY IS RFILE-RELATIVE-KEY
FILE STATUS IS FSTAT-CODE VSAM-CODE.
You should take note of that second data-name for the FILE STATUS
. This is an extension to the simple FILE STATUS, just for VSAM files. It will contain diagnostic information when you have a non-zero FILE STATUS. I suggest you code it, it will make things easier for you.