4 Database Manipulation
The PREDICATE Statement
PREDICATE is provided as an aid in setting up predicate strings. It sets up the qualifier parameter that defines the database entries to be locked via DBLOCK.
PREDICATE predicate FROM set1[,item1][,relop,value] ] [;set2...[;setn..] ]
The parameters are:
- predicate
- A string variable returned by PREDICATE and used as the qualifier parameter in DBLOCK.
- set1
- A string expression specifying the data set to be locked or unlocked.
- item1
- A string expression specifying the data item within set 1 to be locked.
- relop
- A string expression containing a relational operator: = or EQ, >= or GE, <= or LE
- value
- A string or numeric expression giving the value of the item to be locked.
- set2...
- A second set of expressions defining the next lock descriptor.
- setn...
- The nth set of expressions defining the next lock descriptor.
Predicate does no type-checking on the value parameter. The programmer should be careful to match string values with database items or string type and numeric values with database items of numeric type. Any discrepancies will result in a status error from DBLOCK. Blanks within item names and set names are ignored. Where multiple descriptors are specified, the descriptor blocks appear in reverse order in the predicate string.
Each of the following examples defines a predicate to request a lock of all data entries in data set TRANS having a data item value of 100:
100 PREDICATE P$ FROM "TRANS","PART-NO","=","100"
100 Set$="TRANS"
110 Item$="PART-NO"
120 Relop$="="
130 Value=100
140 PREDICATE P$ FROM Set$ , Item$ , Relop$ , Value
The following statement requests a lock on data sets TRANS and INVENTORY (the @ specifies the entire data set):
100 PREDICATE Q$ FROM "TRANS", "@", "INVENTORY", "@"
The following statement requests a lock on all values of PART-NO greater than or equal to 100 in every data set where PART-NO occurs:
100 PREDICATE Q$ FROM "@", "PART-NO", ">=", 100
NOTE: Numeric values will be stored as REAL or INTEGER, depending on expression format and value. INTEGER/DINTEGER will be converted to INTEGER or REAL (depending on value), SHORT and REAL will be converted to REAL.
Eloquence Database Manual - 19 DEC 2002