The FETCH statement is a combined FIND and GET that establishes a
specific record in the database as the current record of the run unit and
makes the record available to the run unit in the User Work Area.
Format -
FETCH database-record
[ FOR UPDATE ]
[ [{| REALM |}] ]
[RETAINING [{| RECORD |}] CURRENCY]
[ [{| { SET [ set-name ] ... } |}] ]
[ [{| { { set-name } ... } |}] ]
[{ [ AT END stment ] [ NOT AT END stment ] } ]
[{ [ ON ERROR stment ] [ NOT ON ERROR stment ] } ]
[ END-FETCH ]
1 – database-record
represents a record selection expression. References are made to a record in the data-base according to the rules for Record Selection Expressions.
2 – set-name
names a subschema set type.
3 – stment
is an imperative statement.