Using VSAM for File Handling

Our Assembler support includes VSAM-style processing of files with the data set organizations ES, KS and RR, providing sequential, indexed and random access. You define your file with the ACB, EXLST and RPL control block macros and process it with the OPEN, CLOSE, GET, PUT, POINT and ERASE request macros. You can also manipulate the ACB, EXLST and RPL control blocks at execution time using the SHOWCB, MODCB, TESTCB and GENCB macros. The two-byte COBOL ANSI 85 file status code is available after every file operation at byte 6 in the access method control block (ACB).

Your files can have fixed or variable record formats. The length of the last record read or written is always available in the RECLEN field of the request parameter list.

You can use one alternate index to access a VSAM KS files. You specify alternate index access with the AIX option of the MACRF parameter of the ACB macro.

We do not support the following mainframe VSAM options: reverse sequential processing, relative byte addressing, control interval access, asynchronous input/output and multiple file positions.

Some of the sample programs provided with our Assembler support illustrate the use of VSAM-style file handling. All of these files are located by default in the %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\Mainframe\Assembler\Classic\VSAM directory:

Program Summary
vsamex1.mlc Reads a variable-length KS file sequentially by key and displays each record on the screen.
vsamex3.mlc Reads a variable-length KS file directly by key, adding new records and optionally updating retrieved records.
vsamex5.mlc Reads a fixed-length RR file, erases any existing records then performs a sequence of tests to demonstrate that records can be written and read sequentially and at random.
vsamex19.mlc Reads a variable-length KS file using an alternate index. The alternate key values are verified after each read and a success or fail message is written to the screen depending on the sequence of records returned.