Was this helpful?
Record Types
The record type is a data type that you use to treat several different pieces of data as one unit, for example, name and phone number. Each of these units is called a variable of record type. Each piece of data is called an attribute. An attribute can be a simple data type, another record type, or an array. A data value or a variable for the record type is called a record.
To define a record type in ABF or Vision, list its attributes. Record types defined in ABF or Vision can be local or global in scope.
To define a record type in 4GL, declare it to be the type of an existing form, table field, or table, or of an ABF-declared record type. Record types defined in 4GL are local in scope.
After you define a record type, you can declare a variable as that record type. This is a record variable. (See Variables above.) A record variable is declared and used the same way you declare variables of simple Ingres data types, such as integer or char.
You can use a record type to create any number of variables with the same attributes. You can also use the record type to define an array.
Records
Records allow you to organize your application by grouping data logically. They can help provide consistency throughout your application. (Records are similar to "records" in Pascal and "structures" in C.)
You can operate on an entire record as a single unit by using its name in a statement.
You can perform operations on the values in the record by using its name and the names of its attributes in a statement.
You can assemble records in arrays (see Arrays below).
For example, you can retrieve a record from a database table and assign all values from the database record to a single 4GL record. You can then map the record as a set of fields in a display (like a row in a table), or you can pass it as a unit to a frame or 4GL procedure. You can also work with the individual attributes of the record with a notation combining the record and attribute names. But the attributes of a record are not ordered, and cannot be referenced by index unless they are records in an array.
The following figure shows the structure of a record type and records. The record type is Stock. The records are named after the imaginary companies, Infinite Industries, Galaxy Books, and Poirot Investigation. The attributes of the record type are the two fields of Stock: Buyer_Name and Date_of_Purchase.
Arrays
An array is a collection of records. Like records, arrays allow you to group data logically and create consistency throughout your application. You can define arrays as global variables through ABF frames or as local variables through 4GL declarations.
Like the arrays defined in 3GL languages, 4GL arrays consist of records that are all of the same record type. By referencing the array itself, you can work with the entire set of included records as a unit.
Unlike 3GL arrays, 4GL arrays are dynamic, allowing you to assign any number of records. The array automatically adjusts as you insert and delete components at any index position.
The index is an integer tag that distinguishes the records in an array from each other. Any record in an array can be addressed by its index at any time.
4GL supports only arrays of records; it does not support arrays of simple data types, as the C programming language does. While you cannot have an array of integers or characters, you can create records from these data types and then make an array of those records. For example, an array can be of a record type Employee, which is made up of three simple fields: Name, Emp_No, and Social_Security_No.
Last modified date: 11/28/2023