RPG has a native way of accessing files and databases on the machine and the READ operation is one.

The READ operation will read the record of a file that is currently pointed to.
The system has a logical pointer in the file that keeps track of there you are in the file. Kind of like when you’re reading a list of things on
a paper and you hover your finger over the line your looking at, and keeps moving it down the list as you continue to browse the list.


All columns in a file declared on the “F-Spec” will become global variables in the RPG program. All variables in the RPG program will get
the values from the READ operation. You can, however, specify a data structure as “factor 2” on the READ operation. This will make
the read operation put the values from the file into the data structure instead of in the global variables.

The read operation of often accompanied by these Operation codes:
– SETLL (Read about it here)
– SETGT (Read about it here)

And these Built in Functions:
– %EOF (Read about it here)
– %STATUS (Read about it here)