Result segments
The data that is retrieved by an SQL statement is always in the form of a segment, which is called a result segment. Like the segments from which you retrieve the data, a result segment has rows and fields. A program fetches this data one row at a time.
Example result segment: Assume that you issue the following SELECT statement, which
retrieves the hospital code and name from the HOSPITAL segment and order the result with the name of
the hospital in ascending order:
SELECT HOSPCODE, HOSPNAME
FROM PCB01.HOSPITAL
ORDER BY HOSPNAME
The result segment looks similar to the following output:
+------------+-----------------+
|HOSPCODE |HOSPNAME |
+------------+-----------------+
|R1210010000A|ALEXANDRIA |
|R1210040000A|NEW ENGLAND |
|R1210030000A|SANTA CLARA |
|R1210020000A|SANTA TERESA |