Declaring a FILE structure with keys in an embed, without putting it in the dictionary

Applies to: Clarion 11 group, September 2019; the answers are general Clarion and apply to the data sections of any procedure.

Problem

The poster asked whether a table (for example CUSTOMER with an ID and a name, and two indexes) can be declared in a procedure's data section without a dictionary entry, and how to declare the indexes.

Solution

  1. Yes, in any data section, including local procedures inside procedures. The templates will not see it.
  2. Easiest start: create a dummy dictionary with the file, wizard a dummy app, generate it and copy the declaration. Or use Copy Details on the file in any dictionary and paste it into the procedure's data declaration section. Importing the structure from an existing .dbf into a dictionary also works.
  3. The shape, from the thread:
FileLabel  FILE,DRIVER('TOPSPEED'),PRE(MYF),CREATE,THREAD
PK_FileLabel  KEY(MYF:MyFileID),NOCASE,PRIMARY
RECORD        RECORD
MyFileID        LONG
Name            STRING(20)
  END
END
  1. Choose the driver with the DRIVER attribute, indexes with INDEX or KEY. Memos and blobs are declared outside the record. See the help topics for FILE, DRIVER, RECORD and KEY.

Caveats

  • A variable file name must be declared static (one poster said global); you can skip NAME() and set PROP:Name.
  • A file or view opened and not closed stays open when the procedure ends, because open state is per thread; one poster saw an app that worked in C4 break in C5 or C6 for this reason. A start of OPEN then CLOSE before filling in the middle was suggested.
  • The dBase, FoxPro and Clipper drivers differ in index format and field types, so pick the driver that matches the file.

Today (2026)

Likely unchanged. Not re-tested.

Sources: Kelvin C. (Sep 2019, the question), Bob C., Graham D., Arnor B., Jeff S., Sean H. (Sep 2019) in sv.clarion.clarion11.