Progress
Programming
Handbook


Specifying Field Lists in the 4GL

You can specify a field list in two different 4GL contexts:

This is the syntax for specifying a field list in all cases:

SYNTAX
record-bufname  
  [   FIELDS [ ( [ field ... ] ) ] 
  | EXCEPT [ ( [ field ... ] ) ] 
] 

The recordbufname reference specifies the table buffer you are using for the fetch, and a field reference specifies a field in the table. If field is an array reference, the whole array is fetched. The FIELDS form lists the fields included in the fetch, and the EXCEPT form lists the fields excluded from the fetch. FIELDS without field references fetches enough information to return the ROWID of a record, and EXCEPT without field references or recordbufname alone fetches a complete record.

Queries versus Record Selection Blocks

For a query, you must specify the field lists in the DEFINE QUERY statement, not the Record phrase of the OPEN QUERY statement. Thus, the following two procedures, p-fldls1.p and p-fldls2.p, are functionally equivalent:

p-fldls1.p
DEFINE QUERY custq FOR customer FIELDS (name cust-num balance). 
OPEN QUERY custq PRESELECT EACH customer. 
REPEAT: 
    GET NEXT custq. 
    IF AVAILABLE(customer) 
        THEN DISPLAY name cust-num balance. 
        ELSE LEAVE. 
END. 

p-rldls2.p
REPEAT PRESELECT EACH customer FIELDS (name cust-num balance): 
    FIND NEXT customer. 
    DISPLAY name cust-num balance. 
END. 

Shared Queries

If you specify field lists in a NEW SHARED query, the matching SHARED query definitions in external procedures only have to include the FIELDS or EXCEPT keyword as a minimum field list reference. The complete field list is optional in the SHARED query definitions, but required in the NEW SHARED query definition.

However, Progress raises the ERROR condition when you run a procedure with a SHARED query if you:


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