Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Database Access : Data-handling statements
 

Data-handling statements

Statements that move data from one location to another are called data-handling statements.
ABL stores data in various locations—a database, a record buffer, a screen buffer, etc. A database stores application data on disk. A record buffer stores data temporarily while a procedure accesses the data, and stores the values of variables used in the procedure. A screen buffer stores data being displayed on the screen or being sent to another output destination; it also stores data that is being entered from the terminal or other input source.
The following figure shows how the data-handling statements move data.
Figure 1. Data movement
To use the above figure, read each statement from top to bottom. The beginning of the first arrow (the dot) indicates the source of the data. The arrowhead of the last arrow indicates where the data is finally stored. For example, the DISPLAY statement gets data from a record buffer and moves it into a screen buffer. Once in the screen buffer, the data is displayed on screen. Also, note that INSERT creates a new database record, moves it to the record buffer, and then to the screen buffer where the user enters data, which is then moved back to the record buffer.
Some statements are made up of other statements. For example, the UPDATE statement is made up of the DISPLAY, PROMPT–FOR, and ASSIGN statements, and performs the same steps as these other statements. First, it copies data from the record buffer to the screen buffer (DISPLAY). Second, it allows data to be entered into the screen buffer (PROMPT–FOR). Third, it copies the data back to the record buffer (ASSIGN).
You can use statements as building blocks, using only as many as you need to do specific tasks. For example, the INSERT statement is very powerful and combines several processing steps into one statement. But in some situations, it is less flexible than using the CREATE, DISPLAY, and SET statements individually (or the CREATE and UPDATE statements).
The following figure shows the primary data-handling statements and shows which statements are composed of other statements.
Figure 2. The primary data-handling statements
Note that the UPDATE, SET, and ASSIGN statements do not actually write records to the database. However, at the end of a transaction (or at the end of the record scope or after an explicit RELEASE), ABL writes all modified records to the database.
If you modify a record using INSERT, UPDATE, or SET, the ABL Virtual Machine (AVM) assigns the change to the record buffer (and, hence, eventually to the database). However, if you use the ENABLE statement, you must explicitly assign any changes with the ASSIGN statement.
For more information on the statements in the above figure, see OpenEdge Development: ABL Reference.