Progress/400
Product Guide


Coding Issues

This section documents coding issues that you must consider when developing an application that uses Progress/400 word indexes.

Most issues involve minor Progress 4GL syntax differences. You generally code Progress 4GL applications that use Progress/400 word indexes identically to those that use standard Progress word indexes; however, there are a few cases when you must use slightly different syntax to achieve the desired result.

WHERE Clause AND Support

The following Progress 4GL program will successfully retrieve records from a table in a Progress database that uses word indexes:

FOR EACH customer WHERE comments CONTAINS "credit" 
AND credit CONTAINS "hold":
  DISPLAY cust-num comments.
END. 

Note that this program uses the AND keyword between the CONTAINS clauses. Remote Progress clients, Version 9.0A or earlier, cannot handle a query of this type. However, you can work around this problem by substituting the following code, which omits the AND keyword and uses normal CONTAINS syntax:

FOR EACH customer WHERE comments CONTAINS "credit & hold":
  DISPLAY cust-num comments.
END. 

Extent Fields

The Progress/400 DataServer supports extent fields just as the Progress database does; however, DB2/400 does not support extents or arrays in DB2/400 physical files. Extent support is provided by placing each element of an extent field contiguously in the physical file’s record format. For example, suppose that you use the Progress/400 Data Dictionary to create a table named TBL1 that contains the following fields:

Field Name
Data Type
Extents
Cust-Num
Integer
0
Name
Character
0
Comment
Character
6

The DDS generated on the AS/400 for this table follows:

Field Name
Data Type
Length
CUST-NUM
Binary
4
NAME
Character
20
Comment01
Character
25
Comment02
Character
25
Comment03
Character
25
Comment04
Character
25
Comment05
Character
25
Comment06
Character
25

Observe that the single six-extent Comment field of TBL1 has been converted to a set of six Commentxx fields in the DDS. These Commentxx fields are unknown to the Progress client. Each Commentxx field represents one element of the Progress extent field, and the fields exist in the record format contiguously. When you build a word index using the Comment field, all of the Commentxx fields are considered to be a single large character file or buffer, and words are pulled from the entire buffer to generate the index.

This conversion of extent fields for AS/400 might cause some unexpected results when querying the file. Since the entire buffer consisting of all of the fields is considered to be the extent field, word separation might be an issue. When the Comment field is updated using the Progress UPDATE statement, each extent of the field is a distinct field; however, when the data entered is sent to the AS/400, it is stored in a single large buffer, and the individual elements of the EXTENT field are not known. This is not true in a Progress database, where each element of the EXTENT field is considered to be a separate field.

Suppose, for example, that:

Now, suppose that you execute the following query:

FOR EACH tbl1 WHERE comment CONTAINS "THIS":
  DISPLAY comment.
END. 

The query does not find THIS because the text in the Comment buffer is as follows:

TEST OF EXTENT WORD BREAKTHIS IS A WORD BREAK TEST

Record Locking

Normal record-locking rules apply when performing query-by-word queries.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095