PreviousNextIndex

COMPILE statement

Compiles a procedure file or a class definition file. A compilation can last for a session, or you can save it permanently for use in later sessions (as an r-code file, which has a .r extension).

When you compile a class definition file, ABL compiles the class definition file identified in the COMPILE statement and all class files in its inherited class hierarchy, by default. You can direct ABL to compile only those class definition files in the class hierarchy that are not found in the cache, and cache any classes or interfaces it compiles during the session, by setting the MULTI-COMPILE attribute to TRUE.

Note: When you change the definition of a class, Progress Software Corporation recommends that you recompile all classes that inherit the modified class. This recommendation does not apply to method logic changes within a class.

After you compile a procedure file, you use the RUN statement to create an instance of the procedure, and you use a handle to access the procedure and its context. After you compile a class definition file, you use the NEW function (classes) to create an instance of the class, and you use an object reference to access the class-based object, as well as its data members, properties, and methods.

For more information about compiling procedure files, see OpenEdge Getting Started: ABL Essentials. For more information about compiling class definition files, see OpenEdge Development: Object-oriented Programming.

Syntax

COMPILE { procedure-pathname | class-pathname | VALUE ( expression ) } 
  [ ATTR-SPACE [ = logical-expression ] ] 
  [ SAVE [ = logical-expression ]  
     [ INTO { directory | VALUE ( expression ) } ] 
  ] 
  [ LISTING { listfile | VALUE ( expression ) }  
     [     APPEND [ = logical-expression ]  
        |  PAGE-SIZE integer-expression  
        |  PAGE-WIDTH integer-expression  
     ] 
  ] 
  [ XCODE expression ] 
  [ XREF { xreffile | VALUE ( expression ) }  
     [ APPEND [ = logical-expression ] ] 
  ] 
  [ XREF-XML { directory | filename | VALUE ( expression ) }  
  ] 
  [ STRING-XREF { sxreffile | VALUE ( expression ) }  
     [ APPEND [ = logical-expression ] ] 
  ] 
  [ STREAM-IO [ = logical-expression ] ] 
  [ LANGUAGES ( { language-list | VALUE ( expression ) } ) 
     [ TEXT-SEG-GROW = growth-factor ] ] 
  [ DEBUG-LIST { debugfile | VALUE ( expression ) } ] 
  [ PREPROCESS { preprocessfile | VALUE ( expression ) } ] 
  [ NO-ERROR ] 
  [ V6FRAME [ = logical-expression ] 
     [ USE-REVVIDEO | USE-UNDERLINE ] ] 
    [ MIN-SIZE [ = logical-expression ] ] 
[ GENERATE-MD5 [ = logical-expression ] ] 

procedure-pathname | VALUE ( expression )
class-pathname
ATTR-SPACE [ = logical-expression ]
XCODE expression
STREAM-IO [ = logical-expression ]
SAVE [ = logical-expression ] [ INTO { directory | VALUE ( expression) } ]
LISTING { listfile | VALUE ( expression ) }
APPEND [ = logical-expression ]
PAGE-SIZE integer-expression
PAGE-WIDTH integer-expression
XREF { xreffile | VALUE ( expression ) } [ APPEND [ = logical-expression ] ]
XREF-XML { directory | filename | VALUE ( expression ) }
STRING-XREF { sxreffile | VALUE ( expression ) }
[ APPEND [ = logical-expression ] ]
LANGUAGES ( { language-list | VALUE ( expression ) } )
TEXT-SEG-GROW = growth-factor
DEBUG-LIST { debugfile | VALUE ( expression ) }
PREPROCESS { preprocessfile | VALUE ( expression ) }
NO-ERROR
V6FRAME [ = logical-expression ] [USE-REVVIDEO | USE-UNDERLINE]
MIN-SIZE [ = logical-expression ]
GENERATE-MD5 [ = logical-expression ]
Examples

In this procedure, ABL compiles the ord-ent procedure, produces an r-code file, ord-ent.r, that can be used across ABL sessions, and saves the r-code file in the current directory:

r-cmple.p
COMPILE ord-ent SAVE. 

Note: The sample procedures supplied with ABL do not include the ord-ent procedure.

You can save the r-code file in a different directory by using the SAVE INTO phrase. For example, to save an r-code file in /usr/sources on a UNIX system, enter this command:

COMPILE ord-ent SAVE INTO /usr/sources. 

The following example shows the effect of include files on compilation listings:

r-incl.p
FOR EACH Customer NO-LOCK: 
  {r-fcust.i} 
  {r-dcust.i} 
END. 

Suppose you use the following COMPILE statement to compile the r-incl.p procedure:

r-comlis.p
COMPILE r-incl.p SAVE LISTING r-incl.lis XREF r-incl.xrf  
  DEBUG-LIST r-incl.dbg. 

This COMPILE statement produces four files: r-incl.r, r-incl.lis, r-incl.xrf, and r-incl.dbg.

The following procedures contain the contents of the r-incl.lis, r-incl.xrf, and r-incl.dbg files:

r-incl.lis
r-incl.p                       06/01/93 13:06:30   PROGRESS(R) Page 1 
{} Line Blk 
-- ---- --- 
      1     /* r-incl.p */ 
      2      
      3   1 FOR EACH Customer NO-LOCK: 
      4   1   {r-fcust.i} 
 1    1   1 /* r-fcust.i */ 
 1    2   1  
 1    3   1 FORM Customer.CustNum Customer.Name LABEL "Customer Name" 
 1    4   1   Customer.Phone FORMAT "999-999-9999". 
      4   1   
      5   1   {r-dcust.i} 
 1    1   1 /* r-dcust.i */ 
 1    2   1  
 1    3   1 DISPLAY Customer.CustNum Customer.Name Customer.Phone. 
      5   1   
      6     END. 
^Lr-incl.p                     06/01/93 13:06:30   PROGRESS(R) Page 2      
     File Name       Line Blk. Type Tran            Blk. Label             
-------------------- ---- --------- ---- -------------------------------- 
r-incl.p                0 Procedure No                                     
r-incl.p                3 For       No                                     
    Buffers: sports2000.Customer 
    Frames:  Unnamed 
^L 

This sample output is not an exact copy of the r-incl.lis file.

There are three columns next to the procedure in the listing file:

  1. {} — The level of the include file
  2. Line — The line number in the file
  3. Blk — The number of the block

The information follows each of the procedure blocks or function blocks:

This is the cross-reference file r-incl.xrf:

r-incl.xrf
r-incl.p r-incl.p 1 COMPILE r-incl.p 
r-incl.p r-incl.p 3 STRING "Customer" 8 NONE UNTRANSLATABLE  
r-incl.p r-incl.p 3 SEARCH sports2000.Customer CustNum 
r-incl.p r-incl.p 4 INCLUDE r-fcust.i 
r-incl.p r-fcust.i 3 ACCESS sports2000.Customer CustNum  
r-incl.p r-fcust.i 3 ACCESS sports2000.Customer Name  
r-incl.p r-fcust.i 3 ACCESS sports2000.Customer Phone  
r-incl.p r-fcust.i 3 STRING ">>>>9" 5 NONE TRANSLATABLE  FORMAT  
r-incl.p r-fcust.i 3 STRING "x(20)" 5 NONE TRANSLATABLE  FORMAT  
r-incl.p r-fcust.i 3 STRING "999-999-9999" 12 NONE TRANSLATABLE  FORMAT  
r-incl.p r-incl.p 5 INCLUDE r-dcust.i 
r-incl.p r-dcust.i 3 ACCESS sports2000.Customer CustNum  
r-incl.p r-dcust.i 3 ACCESS sports2000.Customer Name  
r-incl.p r-dcust.i 3 ACCESS sports2000.Customer Phone  
r-incl.p r-incl.p 6 STRING "CustNum" 8 LEFT TRANSLATABLE  
r-incl.p r-incl.p 6 STRING "Customer Name" 13 LEFT TRANSLATABLE  
r-incl.p r-incl.p 6 STRING "Phone" 5 LEFT TRANSLATABLE  
r-incl.p r-incl.p 6 STRING 
    "-------- ---------------------- --------------" 46 LEFT TRANSLATABLE  
r-incl.p r-incl.p 6 STRING "CustNum" 8 LEFT TRANSLATABLE  

Each line in the xref file specifies the procedure, line number, access type, and access information. The first line in the xref file contains the COMPILE access type directive and the name of the procedure exactly as it appears in the COMPILE statement. See Table 16 for a list of the values that follow a particular access type (for example, table and index after SEARCH).

If you modified r-comlis.p to use the XREF-XML option instead of XREF, your cross reference file would be named r-comlis.xref.xml. The structured formatting of XML would use many more lines to display the same information on one line of standard XREF output. Here is a small snippet of that file:

... 
<Reference Reference-type="INCLUDE" 
Object-identifier=""c:\openedge\wrk\r-fcust.i"">  
  <Source-guid>9+5Nn2plMK7bEdVPTNq+Gw</Source-guid>  
  <File-num>1</File-num>  
  <Ref-seq>6</Ref-seq>  
  <Line-num>4</Line-num>  
  <Object-context />  
  <Access-mode />  
  <Data-member-ref />  
  <Temp-ref />  
  <Detail />  
  <Is-static>false</Is-static> 
  <Is-abstract>false</Is-abstract> 
</Reference> 
<Reference Reference-type="INCLUDE" 
Object-identifier=""c:\openedge\wrk\r-dcust.i"">  
  <Source-guid>9+5Nn2plMK7bEdVPTNq+Gw</Source-guid>  
  <File-num>1</File-num>  
  <Ref-seq>13</Ref-seq>  
  <Line-num>5</Line-num>  
  <Object-context />  
  <Access-mode />  
  <Data-member-ref />  
  <Temp-ref />  
  <Detail />  
  <Is-static>false</Is-static> 
  <Is-abstract>false</Is-abstract> 
</Reference>  
<Reference Reference-type="STRING" Object-identifier="Cust Num">  
  <Source-guid>9+5Nn2plMK7bEdVPTNq+Gw</Source-guid>  
  <File-num>1</File-num>  
  <Ref-seq>17</Ref-seq>  
  <Line-num>6</Line-num>  
  <Object-context />  
  <Access-mode />  
  <Data-member-ref />  
  <Temp-ref />  
  <Detail />  
  <Is-static>false</Is-static> 
  <Is-abstract>false</Is-abstract> 
  <String-ref>  
    <Source-guid>9+5Nn2plMK7bEdVPTNq+Gw</Source-guid>  
    <Ref-seq>17</Ref-seq>  
    <Max-length>8</Max-length>  
    <Justification>LEFT</Justification>  
    <Translatable>true</Translatable>  
  </String-ref>  
</Reference> 
... 

This is the debug listing r-incl.dbg:

r-incl.dbg
 1   /* r-incl.p */ 
 2 
 3   FOR EACH Customer NO-LOCK: 
 4 
 5   /* r-fcust.i */ 
 6  
 7   FORM Customer.CustNum Customer.Name LABEL "Customer 
 8         Name" Customer.Phone FORMAT "999-999-9999".  
 9                  
10 
11   /* r-dcust.i */ 
12 
13  DISPLAY Customer.CustNum Customer.Name Customer.Phone 
14 
15   END. 

Notes
See also

COMPILER system handle, NEW function (classes), RUN statement, Compile Warning List (-cwl), Keyword Forget List (-k), and No Lock (-NL) startup parameters (in OpenEdge Deployment: Startup Command and Parameter Reference)


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex