Using arrays

An array is a group of related pieces of data associated with one variable. You can use arrays as output variables for the into clause of select and fetch statements. For example:

01 author-array.
 10 author-name    PIC X(30)   occurs 100 times.
exec sql
 select au_lname
 from authors
 into :au_array
end-exec.

NoteYou can fetch a single item anywhere into an array. However, you can fetch multiple rows only into the beginning of an array.

For details on using arrays with select and fetch into, see “Selecting multiple rows through arrays” in Chapter 6.