"Quiz" on introduction to VSAM

1.

The program is going to read a sequential file and create an indexed file. The file is going to be indexed on CUST-ID. The SELECT statement coded for the VSAM file is:

SELECT VSAM-OUTPUT-FILE
ORGANIZATION IS ____________
ACCESS IS ____________
__________________.

2.

Where must CUST-ID be defined?

3.

Code the WRITE statement to put the record onto the VSAM file. Assume that the 01 name is VSAM-REC.

4.

Write the SELECT statement that would be used to sequentially read the VSAM file that was just created.

5.

Write the READ statement that would be used to sequentially read the VSAM file that was just created.

6.

I want to sequentially start with CUST-ID equal to or greater than the value stored in TRAN-CUST-ID. First I must establish the KEY - write the code to do this?

7.

Continuing with #6, now I want to issue the START command. Write the correct code assuming that a successful start means performing B-200-PROC and an unsuccessful start means performing B-210-PROBLEM.

8.

If the START is successful, I can immediately start to work with the fields on the first record. TRUE or FALSE and explain.

9.

Write the SELECT statement that would be used to randomly read the VSAM file that was created above.

10.

Write the READ statement that would be used to randomly read the VSAM file that was created above.

11.

Write the SELECT statement that will allow you to read this file both randomly and sequentially within the program.

12.

If you want to randomly read a record from the file what must be done to establish the record you want to retrieve?

13.

Write the READ statement to randomly read a record from the file.

14.

Once you have READ a record randomly, you may now process records sequentially until a condition is met or EOF is reached. Code the READ statement to sequentially read a record in a dynamically accessed indexed file.

15.

Now lets assume this file was changes to include an alternate key based on CUST-NAME. Write the new SELECT that would be used to sequentially process this record.

16.

Assume that you want to start reading sequentially with the name ASH/SUSAN. Code the statement to locate the first record using sequential access.

17.

Continuing from #16, code the statement to READ the record for ASH/SUSAN.

18.

Now lets assume that you want to use dynamic access with this file. Code the SELECT statement.

19.

Code the statement to randomly read the record for ASH/SUSAN (remember you have dynamic access).

20.

Code the statement to sequentially read the next record from the file sequentially (remember you have dynamic access).